OK, now I have a first attempt to submit.

It is what "could" be considered as a cleaner way to address Matej's
initial problem.
But it is a hack to the core, so it's normal that I've come up with
something cleaner I think.

And as it's a modification to the core, it's also more error-prone.

It is too late tonight for me to explain what I did, so please for the
moment take a look at the 2 new classes versions :

wicket.markup.html.form.Form
wicket.markup.html.form.FormComponent

or the diffs files if you prefer.

And I've joined 2 very basic test files (markup & class)

In short : in the new version, on formSubmitted(), child form
components are told that a new user input is available (method
FormComponent.newUserInputAvailable()).
In this method, the FormComponent stores the user input in a rawInput field.
This rawInput is then available for re-rendering for both use cases :
when data is invalid and when model is not up to date (for example
when returning from another page as in Matej's use case, the form will
be rendered again with the rawInput, and not the model).

You can see that it also frees the FormComponent code from the weird
NO_INVALID_INPUT constant (by using a modelUpToDate boolean field)

Fiuu, time to sleep now ! :-)

regards,

--
laurent

Attachment: Form.java.diff
Description: Binary data

Attachment: Form.java
Description: Binary data

Attachment: FormComponent.java
Description: Binary data

Attachment: FormComponent.java.diff
Description: Binary data

Reply via email to