Nicola-H
asked on
ASP - quick check for positive integer value
Hi
I'm validating the contents of a form and need to check that one of the values is a positive integer. Is there an easy way to do this? I can check that it's numeric and that it's positive, but I'm a bit stumped on the integer bit. I basically need a function which will reject all non-integer values.
Thanks :-)
I'm validating the contents of a form and need to check that one of the values is a positive integer. Is there an easy way to do this? I can check that it's numeric and that it's positive, but I'm a bit stumped on the integer bit. I basically need a function which will reject all non-integer values.
Thanks :-)
Do you need a vbscript (asp) check or a clientside (javascript) check?
easiest way is probably to check for a decimalseparator in the string.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
tim's entry works, but it does assume you check serverside.
ASKER
Nice and simple - thanks Tim. It was server side code I needed, and unfortunately checking for decimal separators would not work in circumstamces where the idiot user entered bizarre strings of text. Some of the people who use these forms enter all manner of random carp.