atom feed13 messages in org.apache.struts.userRe: Shale: onclick="disabled='true';"...
FromSent OnAttachments
Jason VincentMay 11, 2006 9:41 am 
James ReynoldsMay 11, 2006 9:49 am 
Craig McClanahanMay 11, 2006 10:59 am 
Jason VincentMay 11, 2006 12:20 pm 
Jason VincentMay 11, 2006 12:21 pm 
James ReynoldsMay 11, 2006 12:39 pm 
Michael JouravlevMay 11, 2006 1:17 pm 
Craig McClanahanMay 11, 2006 2:04 pm 
Michael JouravlevMay 11, 2006 2:17 pm 
Craig McClanahanMay 11, 2006 2:28 pm 
Michael JouravlevMay 11, 2006 2:56 pm 
Craig McClanahanMay 11, 2006 3:02 pm 
Richard WallaceMay 11, 2006 8:47 pm 
Subject:Re: Shale: onclick="disabled='true';" not calling Action Method. (stopping double click)
From:Richard Wallace (rwal@thewallacepack.net)
Date:May 11, 2006 8:47:51 pm
List:org.apache.struts.user

Craig McClanahan wrote:

On 5/11/06, Michael Jouravlev <jmi@gmail.com> wrote:

On 5/11/06, Craig McClanahan <crai@apache.org> wrote:

On 5/11/06, Jason Vincent <jtvi@gmail.com> wrote: According to the HTML specification, disabled input controls are *not* included in the request attributes submitted to the server. Therefore, disabling the submit button will mean that the request parameter telling the server which button was clicked is not included

Unless Javascript is used for form's data collection and submission.

I'd look for a strategy involving capturing the *second* click rather than the first one, so you can make sure the original request is submitted with no modifications.

You mean, to resubimit the same request? What is the point?

As I understand it, the goal of the exercise is to *prevent* the second submit from occurring, while still allowing the first submit to complete properly.

From what I understand that is the intention. I ran into the same thing trying to use the "this.enabled = false;" bit of javascript, but I ran into the same problems as the original poster. The solution I came up with was to do something like the following (in clay):

<script> var formSubmitted = false; </script> <input type="submit" value="Submit" jsfid="commandButton" onclick="if (formSubmitted) return false; formSubmitted = true;" />

This will work on commandLinks as well. The javascript that JSF uses will be put after any that is specified in the onclick javascript, at least with myfaces. The only thing this doesn't do is change the way the button is displayed so it also looks disabled. But it does stop the form from being accidentally submitted by a double click.

Rich