views:

1323

answers:

5

Is it possible to nest html forms? Like so:

<form name="mainForm"> <form name="subForm"> </form> </form>

So that both forms work? My friend is having problems with this, part of the subForm works, while part of it does not.

Thanks

+12  A: 

In a word, no. You can have several forms in a page but they should not be nested.

Craig
and if you try that in asp.net it's not that simple either...
annakata
+1  A: 

As Craig said, no.

But, regarding your comment as to why:

It might be easier to use 1 <form> with the inputs and the "Update" button, and use copy hidden inputs with the "Submit Order" button in a another <form>.

Jonathan Lonowski
I made my cart page like that, he just went a different way and didn't want to change it. I wasn't positive if his method was all that valid either.
Levi
A: 

Even if you could get it to work in one browser, there's no guarantee that it would work the same in all browsers. So while you might be able to get it to work some of the time, you certainly wouldn't be able to get it to work all of the time.

Mike Hofer
A: 

You would even have problems making it work in different versions of the same browser...so avoid using that

MP
A: 

Of Course You Can! The reason that it is not advisable is that when ever you hit submit you automatically take your self to the action="" Destroying all of the information that your client has entered into the other areas of the form.

So how can you nest forms?

By making your subforms process in a blank window! Just use target="_blank" in the form element!

Jason Williams