I wrote this message to the Users list but I now I think it would be better
to ask the devs

...

After playing with Nested Forms in WIcket 1.4.18, I found out that the
onSubmit method of these forms is called at the end of the process.

If a parent form has a button and this button is submited, its onSubmit
method is called before anything.
Then, parent form's onSubmit method is called.
Then, it will navigate through all nested forms calling their onSubmit
method.
The problem is that I have a nested forms that changes a value in the model
that is associated with the parent form.

My usecase has an AddressPanel with a form inside that manipulates the
"person.address" object. This panel is created by informing two
IModel<Address> objects.
One is to be used as the Person's address. The other one is to be used as
copy of, because of a CheckBox that states "Use the same address as of
account holder".

On its onSubmit method, is where I clone the account holder address to the
actual person.address.

But because of the order of how Wicket calls onSubmit methods, this
implementation fails.

Any suggestion?

Should Wicket call all nested forms' onSubmit methods before calling the
Button's onSubmit (or the parent form onSubmit) ?

Thanks,

*Bruno Borges*
(21) 7672-7099
*www.brunoborges.com*

Reply via email to