Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.4.19, 1.5.3, 6.0.0-beta1
-
None
-
None
Description
When a nested form is submitted via a submitting component such as a Button, the browser submits the entire form, and Wicket then determines the correct nested form based on the submitting component's request parameter. Then the nested form is the only one to be processed.
This is a good default, but sometimes it is desirable to have the outer form submitted as well. For example, a panel that can be used on its own will have a form of its own and also submit button, but it could also be integrated in a larger form.
The inner form could be modified to allow submitting an outer form, but this seems to be rather inelegant, especially for more widely re-used components. It becomes especially unwieldy when you have a deep component hierarchy.
Resource string resolution is done in a way that the surrounding containers and the page can override a particular component's strings. I propose that Form gets a new boolean overridable method "wantSubmitOnNestedFormSubmit" that returns false by default to keep behavior the same as in previous versions. onFormSubmitted will then check from the nested submitted form outwards to find the outermost form where this flag is true. This outermost form, if any, will then be submitted.
This way, an outer form can decide it wants to join the inner form's submit without the inner form having to be modified.