View Full Version : form validation
nareshsourav
05-21-2006, 06:58 AM
hi
can any one provide me the form validation.There is a field phone no and email address which user has to enter.so any one can help me in providing the validations for this two fields.The user has to enter the numbers for the phone nunber and it should no accept the char.
Malith
05-22-2006, 08:21 AM
function checkemail(){
var str=document.validation.emailcheck.value
var filter=/^.+@.+\..{2,3}$/
if (filter.test(str))
testresults=true
else {
alert("Please input a valid email address!")
testresults=false
}
return (testresults)
}
Malith
05-22-2006, 08:22 AM
var emailFilter=/^.+@.+\..{2,3}$/;
if (!(emailFilter.test(strng))) {
error = "Please enter a valid email address.\n";
}
Malith
05-22-2006, 08:25 AM
function isNumeric(strString)
{
var strValidChars = "0123456789";
var strChar;
var isOk = true;
if (0 == strString.length)
{
isOk = false;
}
// Test strString consists of valid characters listed above
for (i = 0; (i < strString.length) && isOk; i++)
{
strChar = strString.charAt(i);
if (-1 == strValidChars.indexOf(strChar))
{
isOk = false;
}
}
return isOk;
}
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.