A problem with nested forms arises when the outer form is submitted
and what should happen with the fields of the inner forms.

Consider the following form setup in a page:

outer
   inner1
   inner2
   inner3
   inner4

If you submit the outer form, what should you process now? All inner
forms? In what order? What happens if validation of one of the inner
forms fails?

My proposal is to treat the outer form the same as submitting one of
the inner forms: don't process the input of the form that was not
explicitly submitted. The reason is that it breaks the encapsulation
of the inner forms and therefore can introduce subtle bugs or unwanted
behavior.

If a user of the nested form does want to process the inner forms, it
is a matter of implementing a form visitor that visits all or a
particular inner form and invokes the processing. In this case, the
user is himself responsible for breaking the encapsulation, not us.

The vote: don't process inner form fields when the outer form is submitted
[ ] Yes, don't process those pesky little fields
[ ] No, process them as if they were part of the outer form

Martijn

Reply via email to