[thelist] how to set default submit button?

Andrew Clover and-evolt at doxdesk.com
Sat Jun 19 04:52:58 CDT 2004

Christopher Johnson <thelist at lists.evolt.org> wrote:

> Is there anyway to set a default submit button for a page?

No. In theory if there is more than one submit button in a form, 
pressing return does not submit it. However in practice the first button 
is chosen and included as part of the submission as if it were clicked 
("successful" in HTML terminology). This was originally an IE quirk but 
has been copied by the other browsers. Mozilla goes as far as to 
actually fire a click event on the button.

> A few other restrictions - no javascript is allowed

Oh dear. Well, probably the easist approach in that case would be to 
include a duplicate of your alternative button in a hidden div at the 
very start of the form, so the browser will choose the duplicate as the 
default, and the server-side stuff should see it just the same as if the 
original button were pressed.

> solely based on struts 1.0

[wince of recognition and sympathy]

Andrew Clover
mailto:and at doxdesk.com

More information about the thelist mailing list