Something like the following should work:

decorateScript:
"this.onclick_=this.onclick; this.onclick=function() { return false;
};" + script;

onSuccess,onFailureScript:
this.onclick=this.onclick_; + script;

-Matej

On 9/6/07, Anthony J Webster <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to create a disableable AjaxSubmitLink. When a user clicks on the 
> link further clicks must not result in anything until the 'submission' is 
> complete. This call be achieved by adding "return false;" in a call 
> decorator. However I'm stuggling with the re-enabling. I need to strip the 
> "return false" and put the original destination back.
>
> form.add(new AjaxSubmitLink("randomise", form) {
>
>             protected void onSubmit(AjaxRequestTarget target, Form form) {
>                somethingLong();
>             }
>             protected IAjaxCallDecorator getAjaxCallDecorator() {
>                 return new AjaxCallDecorator() {
>
>                     public CharSequence decorateScript(CharSequence script) {
>                         return "return false;" + script;
>                     }
>                     public CharSequence decorateOnSuccessScript(CharSequence 
> script) {
>                         // NEED TO RESET TO PREVIOUS STATE
>                     }
>                     public CharSequence decorateOnFailureScript(CharSequence 
> script) {
>                         // NEED TO RESET TO PREVIOUS STATE
>                     }
>                 };
>             }
>         });
>
> Any help would be most appreciated.
>
> Thanks in advance
>
> Anthony

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to