Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javascript to submit form

 
AnilPrakash Raju
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need javascript to submit a form in a jsp.

Thanks

Anil
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
document.formName.submit();
 
AnilPrakash Raju
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much

Anil
 
Nat Dickstein
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your form is inside a div-Layer you better use

document.divName.formName.submit();

to make it working in all browsers.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nat Dickstein:
If your form is inside a div-Layer you better use

document.divName.formName.submit();

to make it working in all browsers.


WRONG!

Do not do this!

There is one form object to the page. aka: document.forms
divs do not matter, layers do not matter, elements do not matter.

Eric
 
Bhiku Mhatre
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
document.divName.document.formName.submit();
is needed for SHITscape 4.7. The evil empire(Netscape 4.7) intepreted div as a seperate document. But this approach is not needed for new Generation of netscape browsers.

Regards,
Bhiku.
[ March 11, 2005: Message edited by: Bhiku Mhatre ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My 2 cents:

AS I SAY! Who cares about a browser that has been around since I started coding years ago! It is outdated, it does not support crap. If a business stills says it needs supported, I would laugh at them and say give me $30,000 more a year for that <1% of web users! I think they would see the cost analysis....

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic