On Thu, May 25, 2017 at 12:49 AM, sorinev <sori...@gmail.com> wrote:

> I have a version 7.x application where I have an Ajax component that I add
> some javascript to via this method:
>
>             @Override
>             protected void updateAjaxAttributes(AjaxRequestAttributes
> attributes) {
>                 super.updateAjaxAttributes(attributes);
>                 attributes.getAjaxCallListeners().add(new
> AjaxCallListener()
>                     .onBefore("$('#button1').prop('disabled',true);"
>

Better use #onBeforeSend(). It is called after all preconditions pass.
There is no need to disable if a precondition stops the Ajax request.


>                             + "$('#button2').prop('disabled',true);")
>                     .onComplete("$('#button1').prop('disabled',false);"
>                             + "$('#button2').prop('disabled',false);"));
>             }
>
> Now, I have a v1.4.17 app that I need to do the same thing to, but it's
> going to be on a CheckBox (I could do AjaxCheckBox if necessary). I've
> tried
>

If there is no Ajax request then how you would know when to enable it again
? It seems you need to add Ajax event behavior or use AjaxCheckBox!


> the various solutions I've googled, but to no avail. When the checkbox is
>

Which solutions did you try ?
See IAjaxCallDecorator


> checked, some code runs. While that code runs, I need two buttons to be
> disabled (doing it via the AjaxRequestTarget obviously won't work). When
> the
> CheckBox's onUpdate code finishes running, the buttons can be enabled
> again.
>
> This app is stuck on 1.4.17 for the foreseeable future and that's outside
> of
> my hands.
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Attach-ajax-javascript-to-CheckBox-v1-4-tp4677930.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
>
>

Reply via email to