Hi,
I am trying to validate my form email field if i gave condition for empty field its working then again i checked whether the email id is valid one or not but its working but if i give valid id that time also it displays the alert box only
can anyone tell me wat problem in my code
here is the code
[code=javascript]
function validate()
{
var emailid=documen t.getElementByI d('email')
var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1, 3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
if(emailid.valu e.length==0)
{
alert("Must to enter email id");
emailid.focus()
return false;
}
if (!emailid.match (emailPat)) {
alert("Your email address seems incorrect. Please try again (check the '@' and '.'s in the email address)");
return false;
}
}
</script>
[/code]
I am trying to validate my form email field if i gave condition for empty field its working then again i checked whether the email id is valid one or not but its working but if i give valid id that time also it displays the alert box only
can anyone tell me wat problem in my code
here is the code
[code=javascript]
function validate()
{
var emailid=documen t.getElementByI d('email')
var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1, 3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
if(emailid.valu e.length==0)
{
alert("Must to enter email id");
emailid.focus()
return false;
}
if (!emailid.match (emailPat)) {
alert("Your email address seems incorrect. Please try again (check the '@' and '.'s in the email address)");
return false;
}
}
</script>
[/code]
Comment