zneria
asked on
Number validation vbscript
I've got an old school web page that was built for us many years back. It has an insert page and a submit page that validates some fields and then fowards them to our sql server. Currently it validates if the field is filled in with text or numeric, but I need it to validate for numerics only. Below is the actual text where the validation occurs. Any help would be appreciated.
Dim annual_quantity_n
annual_quantity_n = Replace(Request("annual_qu antity_n") ,"'","''")
Validate annual_quantity_n,"Annual Quantity"
Zach
Dim annual_quantity_n
annual_quantity_n = Replace(Request("annual_qu
Validate annual_quantity_n,"Annual Quantity"
Zach
if is in ASP, something similar:
...
if isnumeric(yourValue) = false then
response.write "The value is not numeric"
'...
end if
..
...
if isnumeric(yourValue) = false then
response.write "The value is not numeric"
'...
end if
..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>>Normally one would write..
that's depends on how a developer write the syntax, which basically both working fine...
that's depends on how a developer write the syntax, which basically both working fine...
If its user input you should have clent side Javascript validation
http://www.google.com/search?q=numbers+only++with+isNaN&hl=en&safe=active
http://www.google.com/search?q=numbers+only++with+isNaN&hl=en&safe=active
ASKER
Sybe I'll go ahead and try this out on the submit page. Jitganguly I'm aware of the javascript however I didn't build these pages and I need it to be vbscript on the submit page, not the input page. Thanks for the 411 though.
>>Thanks for the 411 though.
:-). It was 555 1212 :-)
Good luck
:-). It was 555 1212 :-)
Good luck
ASKER
Sybe,
The code worked like a charm. Can't thank you enough man =)
Zach
The code worked like a charm. Can't thank you enough man =)
Zach
...
if isnumeric(yourValue) = false then
msgbox "The value is not numeric"
exit sub
end if
..