Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'document.form2' is null or not an object.

Status
Not open for further replies.

trc

MIS
Nov 27, 2000
126
CA
Hey.
Error: 'document.form2' is null or not an object.

I am getting this error and I am not sure why nor am I sure of how to get rid of it. Any suggestions?


Here is the function

function SubmitForm()
{
document.form2.submit();
}


Thanks in advance.

************
My purpose in life is to show others what not to do.
<!--Caution, dates on calendar are closer then they appear.-->
 
How are you running this script, or should I say where? It would only show if form2 is not called form2. in the form heading <form ...> specify the name and id as form2:

<FORM id=form2 name=form2 ... >

Otherwise paste the rest of the code and we/someone may be able to help further
 
FredPerry's correct. You either didn't name a form 'form2', or you meant to write:

document.forms[2].submit();

...which would submit the third (indexes are zero-based) form on the page.

--Dave
 

Assuming you have a form named "form2", I'm guessing that you're not running this in IE.

try using this:

Code:
document.forms['form2'].submit();

instead of

Code:
document.form2.submit();

Also make sure you're not calling the submit function until after the document has fuly loaded.

Hope this helps,
Dan
 
Thanks a great deal you guys but it got resolved while I was asleep. Apparently, form2 was declared twice. Doh.

************
My purpose in life is to show others what not to do.
<!--Caution, dates on calendar are closer then they appear.-->
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top