Problem has been solved.  The finish button needs to remain enabled for the 
wizard to submit to the onFinish() method.  So I was not able to mark the 
finish button as disabled.  The javascript/jquery that I had was correct.

To resolve the problem I just hide the finish button once it is pressed and 
show an image of the finish button it's disabled state.



-----Original Message-----
From: Martin Grigorov [mailto:mgrigo...@apache.org] 
Sent: Wednesday, November 16, 2011 11:15 AM
To: users@wicket.apache.org
Subject: Re: Wizard finish button prevent double click

Hi,

On Wed, Nov 16, 2011 at 5:50 PM, Jeffrey Schneller 
<jeffrey.schnel...@envisa.com> wrote:
> Any additional thoughts on this.
>
> I tried just putting an onclick on the button itself.  But it still 
> prevents the form from submitting.  If I remove the onclick then 
> everything works fine.  This should not be this hard.  The button is 
> defined below:
>
> <button class="cmdButton" wicket:id="finish" type="submit"
> onclick="showBusysign();return true;"><wicket:message 
> key=wizardFinishButton"></wicket:message></button>
>
>
> The showBusysign() javascript function is below.  And this does what I 
> expect it should.
>
>         function showBusysign() {
>                        $('#finishbtn').css('backgroundImage',
> 'url(images/button_disable.gif)');
>                        $('#previousbtn').css('backgroundImage',
> 'url(images/button_disable.gif)');
>                        $('#nextbtn').css('backgroundImage',
> 'url(images/button_disable.gif)');
>                        $('#cancel').css('backgroundImage',
> 'url(images/button_disable.gif)');
>
>                        $('#finishbtn').attr('disabled', 'disabled');
>                        $('#previousbtn').attr('disabled', 'disabled');
>                        $('#nextbtn').attr('disabled', 'disabled');
>                        $('#cancel').attr('disabled', 'disabled');

you can combine this selector into jQuery('#btn1, 
#btn2').css(...).prop('disabled', 'disabled')

use prop() instead of attr() check their docs

>         }
>
>
>
>
> -----Original Message-----
> From: Jeffrey Schneller [mailto:jeffrey.schnel...@envisa.com]
> Sent: Tuesday, November 15, 2011 6:41 PM
> To: users@wicket.apache.org
> Subject: RE: Wizard finish button prevent double click
>
> I have.  I even added a breakpoint in my onFinish code to be sure that 
> it was getting there.
>
> I do the bind to the click event in the document onReady.  It 
> definitely fires the jquery but the onFinish code is never executed.
>
>
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
> Sent: Tuesday, November 15, 2011 6:34 PM
> To: users@wicket.apache.org
> Subject: Re: Wizard finish button prevent double click
>
> with jquery have you tried saying $(button).attr("disabled", 
> "disabled") ?
>
> -igor
>
> On Tue, Nov 15, 2011 at 3:29 PM, Jeffrey Schneller < 
> jeffrey.schnel...@envisa.com> wrote:
>
>> I was using version 1.4.3 and recently updated to 1.4.19.  I am 
>> trying
>
>> to prevent the double click of the Finish button causing a double 
>> submit on the finish step of a wizard.
>>
>>
>>
>> Was this resolved between version 1.4.3 and 1.4.19?  Hopefully it was.
>> If not...
>>
>>
>>
>> There was mention of this in the following thread:
>> http://apache-wicket.1842946.n4.nabble.com/Disable-button-double-clic
>> k -w ithout-breaking-Form-setDefaultButton-td3018140.html
>>
>>
>>
>> The proposed solution of adding a Boolean flag to form itself is a 
>> bit
>
>> confusing.  How do you go about doing this.  Do you add a Boolean 
>> field to the model that backs the form that is initially set to false 
>> and then when the onFinish() method fires the field is checked and 
>> only continue if false and then set it to true.  How does this 
>> prevent
>
>> the double submit from occurring?
>>
>>
>>
>> Is there a way to disable the button visually?  In the Apache Wicket 
>> Cookbook (btw, great book) there is the section on blocking until an 
>> Ajax request is complete but the default wizard doesn't appear to be 
>> ajax enabled.
>>
>>
>>
>> If I could bind a click event to the button via jquery that disables 
>> the buttons and then continues with the wizard submit, that would be
> ideal.
>> I can get the jquery bind to occur but the wizard is never submitted 
>> to the onFinish() method. It is like jquery prevents the wicket 
>> javascript from firing.
>>
>>
>>
>> Thanks.
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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

Reply via email to