struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RogerV <>
Subject Forms with Multiple Submit buttons (Bug or Expected?)
Date Wed, 19 May 2010 09:41:08 GMT

For a long while I've been building forms along the lines of

<s:submit id="submit" type="button" label="Continue" action="processForm"/>
<s:submit id="cancel" type="button" label="Cancel"

which has worked well. Until today. Today I needed to prevent a double
submit on a form so I chose the quick way by creating a javascript onsubmit
handler to cancel the button after the first click and referenced it in the
s:form onsubmit handler

<script type="text/javascript">
	var formsubmitted=false;
	function preventDoubleSubmit() {
		if (formsubmitted) {
			return false;
		var submitButton = document.getElementById('submit');
        return true;

On clicking the submit button, the javascript disabled the button but the
performAction was never called and the form was redisplayed. So I tried
again, moving the javascript to the submit buttons onclick attribute. Same
thing. Looking at the POST through Firebug I see that without any javascript
handlers it looks like;

<form data>&action%3performAction=Submit

and with the javascript handlers

<form data> i.e the Struts action information is not being attached.

Is this expected or a bug? Am I handling multiple submit buttons in the
wrong way?


View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message