troubleshooting Question

javascript error checking

Avatar of WebGirlCrissy
WebGirlCrissyFlag for United States of America asked on
JavaScriptScripting LanguagesJScript
7 Comments1 Solution290 ViewsLast Modified:
Hi there - My JS is below and works fine but i want the "state" error checking to reside after the "city" but when i move it up it doesnt work, it only appears to work when i have it listed last in the bunch. I must be missing something but dont know what. Here's the code:
<SCRIPT SRC="formval.js" LANGUAGE="JavaScript"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!-- start hide
function validateForm(form1)
  {
      form1.firstName.value = stripLeadingTrailingBlanks(form1.firstName.value);
  if (isBlank(form1.firstName.value))
    {
    alert("Please enter your first name.");
   form1.firstName.focus();
    return false;
          }
        form1.lastName.value = stripLeadingTrailingBlanks(form1.lastName.value);
  if (isBlank(form1.lastName.value))
    {
    alert("Please enter your last name.");
   form1.lastName.focus();
    return false;
      }
         form1.company.value = stripLeadingTrailingBlanks(form1.company.value);
  if (isBlank(form1.company.value))
    {
    alert("Please enter your company name.");
   form1.company.focus();
    return false;
      }
        form1.streetAddress.value = stripLeadingTrailingBlanks(form1.streetAddress.value);
  if (isBlank(form1.streetAddress.value))
    {
    alert("Please enter your street address, floor number.");
   form1.streetAddress.focus();
    return false;
      }
        form1.city.value = stripLeadingTrailingBlanks(form1.city.value);
  if (isBlank(form1.city.value))
    {
    alert("Please enter your city.");
   form1.city.focus();
    return false;
      }
        form1.zip.value = stripLeadingTrailingBlanks(form1.zip.value);
  if (isBlank(form1.zip.value))
    {
    alert("Please enter your zip.");
   form1.zip.focus();
    return false;
      }
         form1.email.value = stripLeadingTrailingBlanks(form1.email.value);
  if (isBlank(form1.email.value))
    {
    alert("Please enter your email.");
   form1.email.focus();
    return false;
      }
        form1.State.value = stripLeadingTrailingBlanks(form1.State.value);
  if (getCheckedSelectOptions(form1.State.value))
    {
    alert("Please enter your state.");
   form1.State.focus();
    return false;
      }
}
// -->
</script>
ASKER CERTIFIED SOLUTION
Zvonko
Systems architect
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros