Go Back   Velocity Reviews > Newsgroups > HTML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

HTML - Form within a Form - will it cause problems when submitting?

 
Thread Tools Search this Thread
Old 04-13-2005, 12:25 PM   #1
Default Form within a Form - will it cause problems when submitting?


Hello there,

Summary: Is it OK to use Forms within forms and will the right submit button
presses correspond to the correct form action?

Details:

I want to build a big HTML table which will contain certain functionality
that requires the forms to have lots of different command buttons.
I do not want to have to use JavaScript as some users may have it disabled.
Because of the way I will be laying out the form, it will result in a
scenario where I have forms within forms.

Therefore if you imagine the entire table contained within a form, but also
within that table, I also have other smaller forms with different actions if
the user presses a submit button within that form. So generally, when a user
presses a submit button, I want the action that is taken to be the action
defined by the PARENT form that the submit button is contained within.

A further example:
FormA with action "a.htm" has text boxes tb1 tb2, tb3 and a submit button
(named: Asubmit).
It also contains FormB with action "b.htm" which has text box tbB1 and tbB2
and a submit button (named BSubmit).

If the user presses Asubmit I want the action to be a.htm and at least the
text boxes data for tb1 - tb3 to be sent.
If the user presses Bsubmit I want the action to be b.htm and as least the
text boxes data for tbB1 and tbB2 to be sent.

Is this how it will work and will this work in all browsers and is it OK by
HTML standards to do things this way?

I hope this makes sense.


Kind regards

Dave.




Dave Smithz
  Reply With Quote
Old 04-13-2005, 01:04 PM   #2
Steve Pugh
 
Posts: n/a
Default Re: Form within a Form - will it cause problems when submitting?
"Dave Smithz" <SPAM FREE WORLD> wrote:

>Summary: Is it OK to use Forms within forms and will the right submit button
>presses correspond to the correct form action?


No.

>Therefore if you imagine the entire table contained within a form, but also
>within that table, I also have other smaller forms with different actions if
>the user presses a submit button within that form. So generally, when a user
>presses a submit button, I want the action that is taken to be the action
>defined by the PARENT form that the submit button is contained within.


Get rid of the inner form tags, leaving the inputs as they are. Now
you have one big form. Pressing any of the submit buttons will submit
to a single resource on the server. That resource examines the
submitted data, sees which fields have been filled in, sees which
submit button (if any) was used to submit the form and then acts
accordingly.

In the case of forms with hidden inputs or prefilled/preselected
inputs this may mean sending a response back to the user asking them
to confirm/clarify what they wanted to do.

Or redesign the page to eliminate the overlap.

>Is this how it will work and will this work in all browsers and is it OK by
>HTML standards to do things this way?


No. The HTML spec forbids nested forms. Browser behaviour is likely to
be erratic. Don't try it. Either use a single resource to handle all
submissions or redesign the page so that the forms don't overlap.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <> <http://steve.pugh.net/>


Steve Pugh
  Reply With Quote
Old 04-13-2005, 01:42 PM   #3
Jukka K. Korpela
 
Posts: n/a
Default Re: Form within a Form - will it cause problems when submitting?
Steve Pugh <> wrote:

> The HTML spec forbids nested forms. Browser behaviour is likely to
> be erratic.


Technically, for an HTML document that contains nested forms, there is
no such thing as erratic vs. correct behaviour. The HTML specification
imposes no requirements on processing syntactically incorrect
documents, so a browser may crash, or say "beep beep" or "D'Oh!",
or start playing Towers of Hanoi, or even submit some data somewhere,
without violating the specification.

(As a matter of quality of implementation, the pragmatically best
behaviour would probably consist of reporting an error to the user and
prompting for a user choice between some actions that seem meaningful.
But browsers typically have no _planned_ error processing in such
matters.)

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html




Jukka K. Korpela
  Reply With Quote
Old 10-30-2009, 07:24 AM   #4
mokker
Junior Member
 
Join Date: Oct 2009
Posts: 1
Default Embedding forms within another isn't nice at all.
Found this recent blog which definitely provides a way for me to implace another submit button which can be used to load the next dropdown field with JS switched off. Go to markuzweb.blogspot.com/2009/10/embedding-html-forms-within-another.html and read.


mokker
mokker is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to pass selected item from listbox of one form to text box of other form chintan Software 0 12-19-2007 11:38 AM
Re: Pioneer DVR-105 and Nero Problems grams@oldtown.com DVD Video 1 08-12-2003 04:17 AM
Re: Pioneer DVR-105 and Nero Problems Flossie DVD Video 0 08-07-2003 02:25 PM
Re: Pioneer DVR-105 and Nero Problems Flossie DVD Video 0 08-07-2003 08:11 AM
Re: Pioneer DVR-105 and Nero Problems CAM DVD Video 0 08-07-2003 02:30 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46