Hello, I have a form inside a form. The problem is that IE does not submit the parent form for some reason... It works very well in FF and chrome

see same problem

Any help appreciated.

Recommended Answers

All 3 Replies

Ok, let's say you have this forms on this id's (form0, form1). Now apply the code that will do a multiple submit() on those forms, like this:

<script type="text/javascript">
<!-- Must go on the header section of your page. 

Function submitTwoForms() {
   for ( var x = 0; x < 2; x++ ) {
   if ( document.forms ) {
   try {
      document.forms["form"+x].submit();
   } catch( e ) {
      eval('document.form' + x + '.submit();');
   } } else {
      if ( document.all ) {
         document.all['form'+x].submit();
      } else {
         document.getElementById("form"+x).submit();
      }
   }     }
}
// -->
</script>
<div>
<form id="form0" action="#">
<div>
<label for="txt1">field 1: <input type="text" id="txt1" name="txt1" size="30" value="" /></label>
<form id="form1" action="#">
<div>
<label for="txt2">field 2: <input type="text" id="txt2" name="txt2" size="30" value="" /></label>
</div>
</form>
</div>
</form>
<button id="btn" name="btn" onclick="submitTwoForms();">Submit</button>
</div>

Thanks Essential, but still no luck. The nested form contains two select inputs. The second select is populated from the db depending on the selection from the first which is submitted 'onchange'. I don't know if the submit onchange could be preventing the parent form from submitting... But it works perfectly on FF and google chrome. btw, the action of the nested form is linked to another page. In other words, the query that populates the second select is processed on a different page.

> Hello, I have a form inside a form.

If possible, reconsider your design choice; nested forms violate the HTML specification.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.