You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Mathias P.W Nilsson" <ma...@snyltarna.se> on 2008/03/11 13:53:29 UTC
Disable ajaxbutton until process is done
Hi!
I have IndicatingAjaxButton that overloads the onSubmit. When user clicks
everything works great but I need to disable the button immediately after
the user has click the button so that it can't happen twice. I've tried with
this.setEnabled(false); target.addComponent(this); in the onSubmit but it
happens to late.
How can I disable the input type button?
--
View this message in context: http://www.nabble.com/Disable-ajaxbutton-until-process-is-done-tp15976490p15976490.html
Sent from the Wicket - User 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: Disable ajaxbutton until process is done
Posted by "Mathias P.W Nilsson" <ma...@snyltarna.se>.
Thanks =)
Works great!
--
View this message in context: http://www.nabble.com/Disable-ajaxbutton-until-process-is-done-tp15976490p15993390.html
Sent from the Wicket - User 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: Disable ajaxbutton until process is done
Posted by Gerolf Seitz <ge...@gmail.com>.
instead of referencing the id 'create' hardcoded, rather use getMarkupId().
Gerolf
On Tue, Mar 11, 2008 at 9:11 PM, Mathias P.W Nilsson <ma...@snyltarna.se>
wrote:
>
> Thanks! I got it to work now. Is it really a good idé to access html like
> this in javacode?
>
> @Override
> protected IAjaxCallDecorator getAjaxCallDecorator()
> {
> return new IAjaxCallDecorator()
> {
> private static final long
> serialVersionUID = 1L;
> public CharSequence
> decorateScript(CharSequence script)
> {
> return "
> document.getElementById('create').disabled=true;"+script;
> }
> public CharSequence
> decorateOnFailureScript(CharSequence script)
> {
> return script+"
> document.getElementById('create').disabled=false;";
> }
> public CharSequence
> decorateOnSuccessScript(CharSequence script)
> {
> return script+"
> document.getElementById('create').disabled=false;";
> }
> };
> }
> --
> View this message in context:
> http://www.nabble.com/Disable-ajaxbutton-until-process-is-done-tp15976490p15988543.html
> Sent from the Wicket - User 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: Disable ajaxbutton until process is done
Posted by "Mathias P.W Nilsson" <ma...@snyltarna.se>.
Thanks! I got it to work now. Is it really a good idé to access html like
this in javacode?
@Override
protected IAjaxCallDecorator getAjaxCallDecorator()
{
return new IAjaxCallDecorator()
{
private static final long serialVersionUID = 1L;
public CharSequence decorateScript(CharSequence script)
{
return "document.getElementById('create').disabled=true;"+script;
}
public CharSequence decorateOnFailureScript(CharSequence script)
{
return script+"document.getElementById('create').disabled=false;";
}
public CharSequence decorateOnSuccessScript(CharSequence script)
{
return script+"document.getElementById('create').disabled=false;";
}
};
}
--
View this message in context: http://www.nabble.com/Disable-ajaxbutton-until-process-is-done-tp15976490p15988543.html
Sent from the Wicket - User 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: Disable ajaxbutton until process is done
Posted by "Mathias P.W Nilsson" <ma...@snyltarna.se>.
OK! I'm a newbie so could please enhance this a little?
--
View this message in context: http://www.nabble.com/Disable-ajaxbutton-until-process-is-done-tp15976490p15982628.html
Sent from the Wicket - User 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: Disable ajaxbutton until process is done
Posted by Gerolf Seitz <ge...@gmail.com>.
override getAjaxCallDecorator (or something like this) and return a new
IAjaxCallDecorator which appends javascript like "this.disabled=true" in
decorateScript() and maybe activates the button with js returned in
decorateSuccessScript() and/or decorateFailureScript.
Gerolf
On Tue, Mar 11, 2008 at 1:53 PM, Mathias P.W Nilsson <ma...@snyltarna.se>
wrote:
>
> Hi!
>
> I have IndicatingAjaxButton that overloads the onSubmit. When user clicks
> everything works great but I need to disable the button immediately after
> the user has click the button so that it can't happen twice. I've tried
> with
> this.setEnabled(false); target.addComponent(this); in the onSubmit but it
> happens to late.
>
> How can I disable the input type button?
> --
> View this message in context:
> http://www.nabble.com/Disable-ajaxbutton-until-process-is-done-tp15976490p15976490.html
> Sent from the Wicket - User 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
>
>