Link to home
Start Free TrialLog in
Avatar of Nicola-H
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 :-)


Avatar of lluthien
lluthien

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
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
tim's entry works, but it does assume you check serverside.
Avatar of Nicola-H

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.