Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get Javascript to work??
#1
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:

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!
Reply


Messages In This Thread
How to get Javascript to work?? - by eric@rosewood - 2010-10-01, 00:34:00
How to get Javascript to work?? - by Ryan - 2010-10-18, 07:36:48
How to get Javascript to work?? - by yojoe - 2010-10-19, 01:22:56



Users browsing this thread: 1 Guest(s)