The moose likes HTML, CSS and JavaScript and the fly likes document.form.submit(); alternatives Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "document.form.submit(); alternatives" Watch "document.form.submit(); alternatives" New topic
Author

document.form.submit(); alternatives

David Collision
Greenhorn

Joined: May 26, 2004
Posts: 1
Is there any way that a form can have a button or element named "submit" while using document.form.submit()? Or is there another function with javascript that will submit the form? If not I guess I will have to go back to the old fashioned way of clicking it myself.

David
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 23621

David,
No. Javascript wouldn't have any way of knowing whether you wanted the form element of the form function.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Certs: SCEA Part 1, Part 2 & 3 & Core Spring 3, OCAJP
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50679

What exactly is it that you are trying to do?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 411
Technicly speaking, you could clone your form object, obtain pointer to submit method, than insert all your original form parameters into this new form, and then call submit using the pointer you obtained.



I have not tested that, but it should work.
But, I am not sure, does it worth it [ ]
 
 
subject: document.form.submit(); alternatives
 
Threads others viewed
submit a form using javascript
Submitting when the button is called 'submit'
sendRedirect fails to post data along with url if the data is too large
Servlet filter being invoked twice per request by Container.
How to give multiple actions in a single form?
IntelliJ Java IDE