i use the below code for validation
it was work , but when i add mobile validation it is not wok
can you help me to make the mobile validation done?
function validation(form)
{
var Numeric = "^[0-9]+$";
var x=document.forms["myForm"]["email"].value;
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
var txtMobileNumber = document.getElementById("mobile").value;
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
{
alert("Not a valid e-mail address");
return false;
}
if ((form.Fname.value)=="")
{
alert("enter the First emplyee name !!")
return false;
}
if ((form.salary.value)=="")
{
alert("enter the employ's salary !!")
return false;
}
if(form.txtMobileNumber.value == "")
{
alert('Please Enter Required fields\n\n* Indicates Required fields')
return false;
}
if(form.txtMobileNumber.length < 12)
{
alert('Mobile Number must be 12 digits\n\n Enter with country code 91');
return false;
}
if(form.txtMobileNumber.search(Numeric) == -1)
{
alert('Mobile Number must be Numeric');
return false;
document.getElementById("mobile").focus();
}
}
//--></script>

New Topic/Question
Reply



MultiQuote





|