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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Disable ajaxbutton until process is done
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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Disable ajaxbutton until process is done
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Disable ajaxbutton until process is done
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Disable ajaxbutton until process is done
instead of referencing the id 'create' hardcoded, rather use getMarkupId(). Gerolf On Tue, Mar 11, 2008 at 9:11 PM, Mathias P.W Nilsson [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Disable ajaxbutton until process is done
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]