[thelist] JavaScript - form.submit()

Scott_Brady at themoneystore.com Scott_Brady at themoneystore.com
Fri Jul 28 13:44:23 CDT 2000


I'm having problems with using the submit() function on a form in JavaScript.

I've used this plenty of times before, and it's worked without a problem.  But
now, I'm getting a "This object does not support this property or method." error
in IE and "form1.submit is not a function" in Netscape.  All of the verification
works in the function.  It just chokes when it gets through it and it's time to
submit the form.

If anyone has any ideas, I'd be grateful.

Here's the relevant code (it's on an intranet, so I can't provide links):

In the HTML:

< form action="index.cfm?FA=<cfoutput>#attributes.RFA.add#</cfoutput>"
method="post" name="addJobForm" onSubmit="verifyForm(this); return false;">

The verifyForm function in the JavaScript looks like:

function verifyForm(form1)
{

     if (form1.job_title.value == "")
     {
          alert('You must enter a Job Title.');
          form1.job_title.focus();
          form1.job_title.select();
          return false;
     }
     else if (form1.job_code.value == "")
     {
          alert('You must enter a Job Code.');
          form1.job_code.focus();
          form1.job_code.select();
          return false;
     }
     else if ( (form1.Grade.value == "") || (!isInteger(form1.Grade.value)) )
     {
          alert('You must enter a numeric value for the Grade.');
          form1.Grade.focus();
          form1.Grade.select();
          return false;
     }

     form1.submit();
}

Thanks!

Scott






More information about the thelist mailing list