Entry
How do i submit a form automatically without users pressing enter or even clicking the submit button?
Mar 25th, 2003 22:29
Indrayani Vaze, Juergen Thelen, Cedric Chin,
If i hav got more than 1 submit buttons?????
You can use javascript code to submit a form by simply calling the
appropriate forms submit() method. Example:
document.MyForm.submit();
The selection of the way to trigger the call of this method depends on
what kind of conditions you want to be met, before you want the form
beeing submitted.
If it is a static form that could be submitted right after the document
has finished loading, you could use the onLoad handler in the BODY tag
of this document for example.
Or if you just to want to wait for a specific amount of time before
submission starts, simply setup an appropriate timeout using setTimeout
that then triggers the submission.
If some input has to be done by the user beforehand, and/or you want to
validate the forms contents first,then you could use setInterval to
periodically check whether your conditions have been met, and trigger
submission if applicable...
Hope this helps.
Juergen