[Seaside] Nested form tags
Avi Bryant
avi at beta4.com
Mon Jun 28 19:38:11 CEST 2004
On Jun 28, 2004, at 5:23 AM, Bany, Michel wrote:
> I came accross some weird situation when using a component that is
> a composition of other components. A subcomponent may in turn
> be a composition of some more components. To make things even more
> complex, some deeply nested subcomponents may call some other
> component.
>
> Some of the subcomponents may contain some input html tag and as such
> will require to be contained in a form html tag. In such a complex
> construct it may be difficult to decide exactly what component should
> have the responsibility to generate the form tag. Also, it happened
> frequently to me that form tags become nested especially when a
> subcomponent
> calls another component that happens to be a dialog.
Yes, I've found this too. The behavior can be extremely unpredictable
when this happens.
> Therefore I am making the following suggestion : Seaside should prevent
> form tags from being nested. It should discard any form tag that occurs
> within a previously opened form tag.
<snip>
> If my component calls a dialog component, the form generated by
> the dialog component will be discarded if my component happens to be
> used
> from inside a form.
The problem with that is that the dialog component will now be part of
the larger form that is around it, and clicking on buttons in the
dialog will submit the entire form. Depending on what the callbacks
are for that form, this could be undesirable. The browser is also
likely to do unexpected things - for example, if you had this:
html form:
[html submitButtonWithText: 'Foo'.
html form:
[html textInputWithValue: '' callback: [..].
html submitButtonWithText: 'Bar']]
On most browsers, typing into the text input and then hitting return
will automatically press the "Foo" submit button, even though the user
would expect it to select "Bar".
We might be able to deal with the first problem (by only processing
callbacks in the same conceptual form as whatever submit button is
pressed, even if the submission itself is larger because of a shared
form tag), but there's not much we can do about the second one.
So, I don't have a solution. For now it's probably best if there's an
immediate and explicit error whenever you end up with nested forms. It
doesn't help you fix the problem, but at least it alerts you to exactly
what the problem is.
Avi
More information about the Seaside
mailing list