Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Classic ASP versions(v3.4.XX)
 Numeric Check
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

secretsquirrel
New Member

Australia
81 Posts

Posted - 25 June 2007 :  12:57:58  Show Profile  Visit secretsquirrel's Homepage
Have had a look around and tried playing with code but it's time to ask.
How do i check that only numbers are used in a required field?
I altered marital status to become a field for phone numbers so i have the following and just want to add the numeric check and not allow spaces. And yes in thr profile and register it does actually say "Phone Number"

if Len(Trim(Request.Form("MarStatus"))) = 0 then
Err_Msg = Err_Msg & "<li>You must enter your Phone Number.</li>"
end if
if Len(Request.Form("MarStatus")) < 8 then
Err_Msg = Err_Msg & "<li>Your Phone Number must be at least 8 characters.</li>"
end if

Anyone who says a square peg does not fit into a circular hole has never seen a crazy bítch with a hammer

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 25 June 2007 :  13:01:17  Show Profile  Visit HuwR's Homepage
to check for spaces you can use the InStr function, and to check for only numeric values you can try converting the string to a number using the CLng function
Go to Top of Page

secretsquirrel
New Member

Australia
81 Posts

Posted - 25 June 2007 :  13:19:34  Show Profile  Visit secretsquirrel's Homepage
thanks, time to play some more

Anyone who says a square peg does not fit into a circular hole has never seen a crazy bítch with a hammer
Go to Top of Page

pdrg
Support Moderator

United Kingdom
2897 Posts

Posted - 25 June 2007 :  15:43:46  Show Profile  Send pdrg a Yahoo! Message
I vaguely recall an isnumeric() function, if that was in VBScript, that'd work too :)
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 25 June 2007 :  16:16:05  Show Profile  Visit AnonJr's Homepage
There is an IsNumeric() function in VBScript. Just keep in mind that you are going to want to account for those that enter their phone number with dashes and/or parenthesis. It may be a little over-kill, but a quality regular expression would go a long way to making life easier in checking for this...
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.33 seconds. Powered By: Snitz Forums 2000 Version 3.4.07