|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
checking the format function???
hi there i have a form field which i need to validate. this feild can accept numbers as well as this format e.g 1-2 and 1,2,3,4,5
how do i go about it? ![]() |
|
#2
|
|||
|
|||
|
here's a sample html file
<html> <head> <script language="JavaScript"> function chk(wi) {/*all the desired validation here and notify user using alert function .use substring method to find part of the string use win.form.t1.value as an argument*/ win.form.t1.value="" } </script> <body> <form name="f1" action="" method=post> Form field<input type=text name=t1 on blur="chk(this)"> </form> </body> </html> hope this helps you |
|
#3
|
||||
|
||||
|
Sounds like you'll want ot use regular expressions. It's a little complex unless you've used it before and become familiar. It's fun though. Here are a couple links:
http://www.regular-expressions.info/javascript.html http://devedge.netscape.com/library...xp.html#1193136 Here you can test your work: http://reliableanswers.com/js/rxtest.asp http://b-cage.net/irc/scripts/regexp.html I may get motivated and try to see if I can figure it out for you ![]() |
|
#4
|
||||
|
||||
|
pattern = /(([0..9]),(-|\,))+/gi;
I haven't tested this at all but it might be along these lines. |
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > checking the format function??? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|