2010-10-01, 00:34:00
I have some javascript that I have used on other websites (made with a different CMS, but not CMS specific javascript) that I have used for required fields on my contact forms. For some reason I can not get it to run in GetSimple. Is there something unique I need to do to get it to run?
Here is my javascript:
Then I make a form using the field names above (and others)...and call for the javascript like this:
I am using ScriptInjector to insert the script right before my form. (Although I have put the javascript in the head also, but that didn't work either.)
Attached is an html file of the page source also.
Any ideas?
Thanks!
Here is my javascript:
Code:
<script type='text/javascript' language='javascript' >
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
{
alert(alerttxt);return false;
}
else
{
return true;
}
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_required(method,"Please choose a delivery method")==false)
{method.focus();return false;}
if (validate_required(company_name,"Please enter your Company Name")==false)
{company_name.focus();return false;}
if (validate_required(contact_name,"Please enter your Contact Name")==false)
{contact_name.focus();return false;}
if (validate_required(address,"Please enter your Address")==false)
{address.focus();return false;}
if (validate_required(city,"Please enter your City")==false)
{city.focus();return false;}
if (validate_required(state,"Please enter your State")==false)
{state.focus();return false;}
if (validate_required(zipcode,"Please enter your Zipcode")==false)
{zipcode.focus();return false;}
if (validate_required(phone,"Please enter your Phone")==false)
{phone.focus();return false;}
}
return confirm("Have you entered all your information correctly? Click OK to submit.");
}
</script>
Then I make a form using the field names above (and others)...and call for the javascript like this:
Code:
<form action="registration.php" method="get" name="registrationform" onsubmit="return validate_form(this)">
I am using ScriptInjector to insert the script right before my form. (Although I have put the javascript in the head also, but that didn't work either.)
Attached is an html file of the page source also.
Any ideas?
Thanks!