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

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

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');
                submitButton.disabled=true;
                formsubmitted=true;
        return true;
        }
</script>

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?

Regards

-- 
View this message in context: 
http://old.nabble.com/Forms-with-Multiple-Submit-buttons-%28Bug-or-Expected-%29-tp28606047p28606047.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to