Freelancers Network
 
skill list top cap
Homepage
Join the Freelancer's Network
Update your details
Find a freelancer
Post a project
Find a project
Projects Archive
Post a job
Find a job
Jobs Archive
See Dan's Pages
See Andy's Pages
Link to this site
Resources
Join/Leave Forum
Forum Messages
+Additions+ Adverts
Advertising
Contact Us
Subscribe to our newsletter - enter your email address and hit return
Freelancers.net is owned and operated by Andy Stowell and Dan Winchester
skill list end cap
guru web hostcom

Find me again on Freelancers.net

RE: RE: FN-FORUM: javascript validation of phone numbers - allow spaces?

date posted 24th October 2006 15:58

quite right, the isNaN part just checks for anything non numeric


>
>I'm guessing it also doesn't work if you input your number like...
>+44 (0)1382 555666
>
>Cheers,
>Gary
>http://www.garyshort.org/
>
>
>> -----Original Message-----
>> From: [EMAIL REMOVED] [EMAIL REMOVED] On Behalf Of
>> [EMAIL REMOVED]
>> Sent: 24 October 2006 16:07
>> To: FN-FORUM / [EMAIL REMOVED]
>> Subject: FN-FORUM: javascript validation of phone numbers - allow spaces?
>>
>>
>> Afternoon all
>>
>> I'm trying to script a form validator in JS and I'm struggling with this
>final
>> part - validating phone numbers. Currently I'm using this (having set the
>> value of contactNumber previously)...
>>
>> if (contactNumber.value == "" || isNaN(contactNumber.value)) {
>> ErrorMsg.innerHTML = 'Please Enter a Telephone Number';
>> contactNumber.style.backgroundColor = '#FFD5D5';
>> return false;
>>
>> which throws an error if the number input box is blank or contains a non-
>> numeric char. I thought that was all I needed to do until I showed the
>client
>> and he entered his phone number with spaces! ack!
>>
>> could this be done with regular expressions? if so I'd really apreciate
>> someone telling me what the expression would be, I've neevr understood
>them.
>> Otherwise, how else can it be done?
>>
>> Thanks
>>
>> Chris
>>
>> --
>> Freelancers, contractors earn more with Prosperity4
>> Call 0870 870 4414 or visit www.prosperity4.com
>> and benefit from Inland Revenue approved expenses today.
>>
>> To advertise here: http://www.freelancers.net/advertising.html
>>
>>
>--
>Freelancers, contractors earn more with Prosperity4
>Call 0870 870 4414 or visit www.prosperity4.com
>and benefit from Inland Revenue approved expenses today.
>
>To advertise here: http://www.freelancers.net/advertising.html
>
>



Messages by Day
October 31st 2006
October 30th 2006
October 29th 2006
October 28th 2006
October 27th 2006
October 26th 2006
October 25th 2006
October 24th 2006
October 23rd 2006
October 22nd 2006
October 21st 2006
October 20th 2006
October 19th 2006
October 18th 2006
October 17th 2006
October 16th 2006
October 15th 2006
October 14th 2006
October 13th 2006
October 12th 2006
October 11th 2006
October 10th 2006
October 9th 2006
October 8th 2006
October 7th 2006
October 6th 2006
October 5th 2006
October 4th 2006
October 3rd 2006
October 2nd 2006
October 1st 2006


Messages by Month
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006


Messages by Year
2008
2007
2006
2005
2004
2003
2002
2001
2000