[html5] How do you overcome the HTML form nesting limitation?

Sagara sagara1337 at gmail.com
Thu May 13 10:13:11 PDT 2010


1. Why we don't allow nested forms in HTML5?

Problem is originally described at
http://stackoverflow.com/questions/597596/how-do-you-overcome-the-html-form-nesting-limitation
*In short author says:*

You are making a blog app and you have a form with some fields for creating
a new post and a toolbar with "actions" like "Save", "Delete", "Cancel".
Our objective is to write the form in a way that doesn't require javascript,
just plain old html form and submit buttons.
Since the action url is defined in the Form tag and not in each individual
submit button, our only option is to post to a generic url and then start
"if...then...else" to determine the name of the button that was submitted.
Not very elegant, but our only choice, since we don't want to rely on
javascript.

The only problem is that pressing "Delete", will submit ALL the form fields
on the server even though the only thing needed for this action is a Hidden
input with the post-id. Not very big deal in this small example, but I have
forms with hundreds (so to speak) of fields and tabs in my LOB applications
that (because of requirements) have to submit everything in one-go and in
any case this seems very inefficient and a waste. If form nesting was
supported, I would at least be able to wrap the "Delete" submit button
inside it's own form with only the post-id field.
---

One answer was to re-design the app so users could delete items without
opening them...
Another answer was to have the forms side by side on the page, but not
nested. then use CSS to make all the buttons line up pretty. But... it is "too
hackish. Plus in a very large page ... it's almost impossible to completely
separate the elements' screen position from their position in the document".
*2. So, is there any elegant solution in HTML5, without JavaScript, and with
several buttons to submit different sets of input fields (to the same or
different URL(s)?*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/help-whatwg.org/attachments/20100513/f470bd7e/attachment-0002.htm>


More information about the Help mailing list