Hi,

On Thu, May 25, 2017 at 5:40 PM, sorinev <sori...@gmail.com> wrote:

> I've tried adding an AjaxEventBehavior to the regular CheckBox and to the
> AjaxCheckBox. I tried a few different things, the latest one is this:
>
>         fooCheckBox.add(new AjaxEventBehavior("onbefore"){
>

There is no JavaScript named "onbefore".
You need "onchange".


>             @Override
>             protected IAjaxCallDecorator getAjaxCallDecorator(){
>                     return new IAjaxCallDecorator(){
>                         public CharSequence decorateScript(CharSequence
> script) {
>                             return "$('#button1').prop('disabled',true);"
>                                     + "$('#button2').prop('disabled'
> ,true);"
> + script;
>                         }
>
>                         public CharSequence
> decorateOnSuccessScript(CharSequence script) {
>                             return script;
>                         }
>
>
Here you probably need to enable the buttons again.


>                         public CharSequence
> decorateOnFailureScript(CharSequence script) {
>                             return script;
>                         }
>
>                     };
>             }
>
> And a similar one for oncomplete. There doesn't seem to really be much
> inside the AjaxCheckBox itself, unlike some of the other Ajax components
> that have a ton of things that can be overridden (including an internal
> getAjaxCallDecorator. There's basically just the one onUpdate method and
> that's it.
>
> I am very light on front end knowledge and sometimes wicket is hard to find
> non-api-doc info for. It's really hard to find good information for what to
> do in specific situations. So I may be going about this the wrong way, but
> like I said, I tried a few other things I found I just don't remember
> specifically what they were.
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Attach-ajax-javascript-to-CheckBox-v1-4-
> tp4677930p4677932.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