I have a scenario where I have a form and the user puts in a bad value in
FieldA, and then also puts in proper values in FieldB and FieldC.  FieldB
and FieldC never receive their values (in the model object), I’m assuming
because the form processing stops at the error for FieldA.  The user
dismisses the model (which just makes the component not visible and does an
Ajax refresh).

The user then goes in to edit the data again (same component, just made
visible and refreshed with an Ajax request).  Before the panel is shown the
underlying model object is swapped out with a new one (that has no values
in all 3 fields), however, when it appears the data is as it was
previously, including the unsaved values in FieldB and FieldC (from the
first pass).

This surprised me a bit (not that I’m anywhere near a wicket expert), I
would have assumed that since the model object changed that the form
components would refresh.  So in hacking around, I found that if I visit
all the FormComponents and call clearInput() on them, the form will display
the correct values (blank in this case).  Calling clearInput() on the form
itself has no impact (which also surprised me).

What’s the proper way to handle this case? I feel like while I have a
working case, it’s a little clunky.


Reply via email to