dcsimg
Newbie Q - Validation
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Al_Fiori
Posted On:   Wednesday, February 19, 2003 02:46 AM

i have this function: function telephoneValidator(formObj) { if (formObj.Telephone.value.length < 10) { alert("Please enter a valid Telephone number. Telephone numbers should be at least 10 digits and no more than 18 digits in length."); formObj.Telephone.focus(); return (false); } return (true); } i would like to validate it further by making sure there is a leading 0 (zero) at the beginning of the number (like 01256354212), the digits should not exceed 18, so far i've been able to validate only <10 and finally only numbers allowed. Can anybody help? Thx    More>>

i have this function:


function telephoneValidator(formObj)
{
if (formObj.Telephone.value.length < 10)
{
alert("Please enter a valid Telephone number. Telephone numbers should be at least 10 digits and no more than 18 digits in length.");
formObj.Telephone.focus();
return (false);
}
return (true);
}



i would like to validate it further by making sure there is a leading 0 (zero) at the beginning of the number (like 01256354212), the digits should not exceed 18, so far i've been able to validate only <10 and finally only numbers allowed.


Can anybody help? Thx    <<Less

Re: Newbie Q - Validation

Posted By:   Anonymous  
Posted On:   Wednesday, February 19, 2003 06:44 AM

Search the web for regular expressions in javascript. These regular expression can greatly ease complex validations.
About | Sitemap | Contact