| Author |
number validation using validator
|
vidya sagar
Ranch Hand
Joined: Mar 02, 2005
Posts: 580
|
|
Hi all In a form, i should not allow the user to type any characters other than numbers. Currently i am using struts 1.1 Validator, which is showing error on submission only. Thanks in advance
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
|
Struts validation is designed to be invoked only when a form is submitted. If you want something other than that, you will have to write it yourself in javaScript.
|
Merrill
Consultant, Sima Solutions
|
 |
vidya sagar
Ranch Hand
Joined: Mar 02, 2005
Posts: 580
|
|
hi Merrill Thanks for ur reply.......I go for Javascript One more small doubt??? I want to validate a username on registration, Name should start with character and not a number,but number can present except as a first character.......... For this too i want to go for javascript OR any other way to do in struts validator itself
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
You can accomplish this with the match() string function in javaScript along with a regular expression (regex). If you're not familiar with regular expressions, here's a link to learn how to use them: http://www.regular-expressions.info/
|
 |
 |
|
|
subject: number validation using validator
|
|
|