Can't figure out how to validate a phone number. Such as: Number has to be in (123) 456-7890 format.
Have this code to validate data is entered:
Any idea how to validate the phone number structure (and e-mail as well!!!) for this form:
Thank you!
AW
Have this code to validate data is entered:
Code:
<script type = "text/javascript">
function validate()
{
if (theform.name.value=="")
{
alert('Your name is required!');
return false;
}
if (theform.phone.value=="")
{
alert('How can we call you without a phone number!!');
return false;
}
if (theform.email.value=="")
{
alert('Your email is required!');
return false;
}
}
</script>
Any idea how to validate the phone number structure (and e-mail as well!!!) for this form:
Code:
<form name= "theform" onsubmit="return validate();" method="post" action="[URL unfurl="true"]http://matrix.csis.com/~s04-it604-s13/cgi-bin/insertEst.pl">[/URL]
Your Name<br>
<input type="text" name="name" size=30>
<p>
Email Address<br>
<input type="text" name="email" size=30>
<p>
Your Phone Number<br>
<input type="text" name="phone" size=15>
AW