Form data type validation

liunx

Guest
Hi I have a form in which I want to make sure that the user enters appropriate data. How do I validate that the user enters in strictly integers (not strings or nasty characters)in a form.
In addition it should be non negative integers.Did you want to do this client side or server side?

Because you can create a custom validator. It can do a client side check of the textbox value. It's efficent but everyone can see your code.

It can also do server side checking, but it involves the page to be re-loaded. However, no one can see your code.

I tend to do everything client side, saves the page being sent back (and having to re-type passwords), and then if thats all ok, you can then do the server side check (ie check database) and if thats all ok then it's good to go.

It should be a drag and drop thing on the side of your VS, if you dont run VS, google for the right tags.regular expression for integer only input: ^\d*[0-9]$
put that in ur regularexpressionvalidator
 
Back
Top