Sisira 95

we have one .net application where we need to use the nested HTML form as in the following example.

   <form action="#" method="post" id="outer-form">
  <form action="#" method="post" id="inner-form-1">
      <input type="text" id="inner1-input" name="inner1-input"/>
      <input type="submit" id="inner1-submit" value="Submit inner form"/>
    <input type="text" id="container-input" name="container-input"/>
    <input type="submit" id="container-submit" value="Submit outer-form"/>      

Actually i as per my knowledge this is not as per w3c specification. So I wanted to know the w3c specification for this. Any pointer in terms of use ful informative link would be helpful. Thanks in advance.

1 answer

danwellman 5600

It is not valid XHTML to put a <form> inside another <form>. Not sure about HTML5, and as you can put links inside of other links (last time I checked anyway!) I wouldn't want to guess at this one...

This got me when I first started using .Net too, but it is not really a problem. With flat html or PHP, the <form> element is required for forms to get the action attribute to tell the page where to send the form data and the method attribute etc, but .Net handles this for you anyway with the .Net form controls, <asp:Textbox> etc, with id attributes and runat="server" so the <form> element is not needed.

If you need a container just use a <fieldset>...

Answered over 8 years ago by danwellman
  • Yah, I agreed and the W3C specification Link Sisira over 8 years ago