Prevent submit

2013-03-15 Thread Alexey Mukas
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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Prevent submit

2013-03-15 Thread Martin Grigorov
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 alexey.mu...@gmail.comwrote:

 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-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




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


Re: Prevent submit

2013-03-15 Thread Alexey Mukas
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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Prevent submit

2013-03-15 Thread Alexey Mukas
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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org