You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alexey Mukas <al...@gmail.com> on 2013/03/15 15:59:37 UTC

Prevent submit

Hi all,

I have a form, which server-side processing takes takes 2-5 sec, at this
time user can resubmit the form, this call goes to a queue and will be send
right after the first  one.

I tried to play around the IAjaxCallListener but with no luck.

How can I avoid this behaviour?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Prevent-submit-tp4657277.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Prevent submit

Posted by Alexey Mukas <al...@gmail.com>.
Did it :)

        onBeforeSend("this.setAttribute('disabled', 'disabled');");
        onComplete("this.removeAttribute('disabled');");

Thanks once again



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Prevent-submit-tp4657277p4657280.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Prevent submit

Posted by Alexey Mukas <al...@gmail.com>.
Hi Martin,

Thank for the fast reply, could you please tell me how can I manipulate it
(make disable/enable) in those callbacks? 

Before your answer I came up with very dirty solution...

public class AjaxBlockingListener extends AjaxCallListener{
    public AjaxBlockingListener() {
        String clearCallbackQueue =
"Wicket.channelManager.channels[0].callbacks.length = 0";
        onComplete(clearCallbackQueue);
    }
}




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Prevent-submit-tp4657277p4657279.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Prevent submit

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You can disable the submit link/button in beforeSend handler and re-enable
it in complete handler.
This will work only if you make Ajax submit.

For non-Ajax you will need to add onclick attribute to just disable it.


On Fri, Mar 15, 2013 at 3:59 PM, Alexey Mukas <al...@gmail.com>wrote:

> Hi all,
>
> I have a form, which server-side processing takes takes 2-5 sec, at this
> time user can resubmit the form, this call goes to a queue and will be send
> right after the first  one.
>
> I tried to play around the IAjaxCallListener but with no luck.
>
> How can I avoid this behaviour?
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Prevent-submit-tp4657277.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


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