dropdownchoice onchange event called before propertymodel updates

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

dropdownchoice onchange event called before propertymodel updates

Matthew Goodson
This post has NOT been accepted by the mailing list yet.
Hi,
I have a dropdownchoice which determines what details that a form holds. The problem that I am having is that the ajax event is being called before the property model updates the field. So the addVehicleFormPanel is being rendered with the old value and now the new selected one.
Hopefully that makes sense.
I am a bit of a newbie to wicket so dumb it down if you can.
Any help is very much appreciated. Thanks

DropDownChoice<Vehicle> vehiclesDropDown = new DropDownChoice<Vehicle>(
        "vehicleSelect", new PropertyModel<Vehicle>(this, "selectedVehicle"),
        new PropertyModel<List<Vehicle>>(user, "vehicles"),
        new WebOptionStringChoiceRender<Vehicle>())

vehiclesDropDown.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        private static final long serialVersionUID = 1L;
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                        target.addComponent(addVehicleFormPanel);
                }

        });