Hi,

calling myTextField.clearInput() would be the recommended solution.

Have fun
Sven


On 11.05.2016 17:31, marco di gasbarro wrote:
Hey All,
I'm dealing with a user interaction problem after a failed Form validation.
In fact I have a Form with two components: a DropDownChoice and a TextField.
The DropDownChoice has an AjaxFormComponentUpdatingBehavior attached, which
modifies the TextField's model object and then adds the TextField itself to
the AjaxRequestTarget.

When the Form validation fails, the DropDown's Behavior changes the
TextField's underlying model object correctly, adds the TextField to the
Target, but the TextField renders with the old converted input, which
doesn't reflect the changes.

If on the one hand it looks like a Wicket's feature to leave the Form
components showing the input which couldn't be validated, on the other hand
a flexible user interaction should let the component to be notified about
the changes occurred on its model object.

By now I work around it calling inputChanged() on the TextField before
adding it to the Target.
Is there any best practice which covers this use case?

Here is a snippet:

new AjaxFormComponentUpdatingBehavior("change"){
                 @Override
                 protected void onUpdate(AjaxRequestTarget target) {
                     //update the TextField model object

getMyFormModelObject().setMyTextFieldModelObject(newValue);
                     //temporary workaround
                     myTextField.inputChanged();
                     //add the textfield to the Target
                     target.add(myTextField);
      }
}


Thanks in advance for your help!
--
Marco



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to