Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

num check

Status
Not open for further replies.

christoffer

Technical User
Jan 26, 2004
1
ZA
hi...
i have a form which contains some fields...
in one of the fields you are asked to enter a number.
How can i run a check to make sure the user has typed a number and not a string?

-chris
 
You would do this on the client side, in Javascript. When the user submits the form, make sure the field in question contains a numeric value by using the Javascript NaN() function.
 
if you wanted to validate it AFTER the user has sent it back(though I think it still works best to validate it on clientside) you can use the VBscript function called IsNumeric() throw the string inside of the (), and it'll return true or false if it's numeric ( I assume it accepts any digits including decimals as numeric characters)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top