Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AjaxFormComponentUpdatingBehavior not working in Wicket 8

Tags:

java

ajax

wicket

I'm switching from Wicket 6 to Wicket 8, and AjaxFormComponentUpdatingBehavior doesn't seem to work anymore.

Example page:

    public HomePage() {
        final Form<Void> form = new Form<>("form");
        final TextField<String> txt = new TextField<>("txt", new Model<>());
        txt.add(new AjaxFormComponentUpdatingBehavior("onchange") {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onUpdate(final AjaxRequestTarget target) {
                System.out.println("update: " + txt.getValue());
            }
        });
        form.add(txt);
        add(form);
    }

and corresponding html:

<form wicket:id="form">
<input wicket:id="txt">
</form>

In Wicket 8.5.0, the onUpdate method never gets called, and there is no error message. In Wicket 6 it works fine. The same thing happens with other component types, e.g. select/DropDownChoice.

Is this a bug? Or what am I doing wrong?

like image 392
aditsu quit because SE is EVIL Avatar asked Nov 29 '25 18:11

aditsu quit because SE is EVIL


1 Answers

The events prefixed with on have been deprecated since Wicket 6. In Wicket 8, support for them has been removed. You can get these components to work again by changing onchange to change.

See also: https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+8.0

like image 188
Jeroen Steenbeeke Avatar answered Dec 01 '25 07:12

Jeroen Steenbeeke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!