tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dimitris Zenios <dimitris.zen...@gmail.com>
Subject Re: Disable double submission
Date Wed, 02 Nov 2011 17:21:24 GMT
Steve thanks for your suggestion but again this have problems when we
have validation errors.The button gets disabled and then there is no
way to enable it and second you can also submit a form by pressing
enter on the keyboard.

>From all the above this solution is not ideal.

On Wed, Nov 2, 2011 at 7:03 PM, Steve Eynon
<steve.eynon@alienfactory.co.uk> wrote:
> Hmm... if your Mixin is taken from Jumpstart:
>
> http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/creatingmixins1
>
> and the JS looks like:
>
> var alreadyClickedOnce = false;
>
> ClickOnce = Class.create( {
>
>        initialize: function(elementId) {
>                Event.observe($(elementId), 'click',
> this.doClickOnce.bindAsEventListener(this));
>        },
>
>        doClickOnce: function(e) {
>                if (alreadyClickedOnce) {
>                        e.stop();
>                }
>                alreadyClickedOnce = true;
>        }
> } )
>
> then you could try making the alreadyClickedOnce var scoped inside the
> class, so any subsequent new classes (for new submit buttons) would
> have their var set to false.
>
> Sorta like (apologies, I'm not JS expert):
>
> ClickOnce = Class.create( {
>    var alreadyClickedOnce = false;
>
>        initialize: function(elementId) {
>                Event.observe($(elementId), 'click',
> this.doClickOnce.bindAsEventListener(this));
>        },
>
>        doClickOnce: function(e) {
>                if (alreadyClickedOnce) {
>                        e.stop();
>                }
>                alreadyClickedOnce = true;
>        }
>
> } )
>
> Steve.
>
>
>
>
> On 2 November 2011 23:30, Dimitris Zenios <dimitris.zenios@gmail.com> wrote:
>> Yeap.The whole form is inside the zone.
>>
>> On Wed, Nov 2, 2011 at 5:28 PM, Steve Eynon
>> <steve.eynon@alienfactory.co.uk> wrote:
>>> Um, I mean...
>>>
>>> Is the submit button inside the Zone that gets re-rendered during the
>>> Ajax form submission?
>>>
>>> Steve.
>>>
>>>
>>> On 2 November 2011 23:24, Dimitris Zenios <dimitris.zenios@gmail.com> wrote:
>>>> What do you mean rerender ?I am not handling the rendering of the
>>>> button my self.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Mime
View raw message