Validate Form?
-
Topic
-
Hi there, we want to have a javascript snipet to validate our form here:
http://ugly.thirstyagent.com/webinar
I have the code at:
function validateForm()
{
var a=document.forms["myform"]["inf_field_FirstName"].value;
var b=document.forms["myform"]["inf_field_Email"].value;
var c=document.forms["myform"]["inf_field_Phone1"].value;
if (a==null || a=="" || a=="First Name Here")
{
alert("Please enter your First Name!");
return false;
}
var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
if (document.myform.inf_field_Email.value.search(emailRegEx) == -1)
{
alert("Please enter a valid email address.");
return false;
}if (c==null || c=="" || c=="Enter Your Phone Here")
{
alert("Please enter your Phone Number!");
return false;
}and the code doesn’t seem to be validating the form – it goes to an ugly page after to validate rather than keep the user inside the site to validate. Any help is appreciated
Thanks
- The forum ‘Alyeska Responsive WordPress Theme’ is closed to new topics and replies.