2
<script>
  function(form)
  {
     form.submit();
  }
</script>

<form action="do-1" id="frm1" method="post" >
   <form action="do-2" id="frm2" method="post" >
       <input type="submit" name="submit" value="submit" onclick="test(this.form)"
   </form>
</form>

someone tell me how to submit frm2 by js ?

i click and it always submit frm1 :(

Do it is impossible ?

4 Answers 4

8

Per the W3C, you can't nest form tags.

Every form must be enclosed within a FORM element. There can be several forms in a single document, but the FORM element can't be nested.

I doubt browsers will consistently handle nested forms intuitively in your case. From my experience by accidentally nesting form tags, IE8, for example, will not even render them properly. It causes many layout problems.

Sign up to request clarification or add additional context in comments.

Comments

1

Keep only one form tag and one /form close tag. As everyone says, you can not nest the form tag in html.

And make sure your input tag is closed properly.

Example:

<form action="get.jsp" method="post" >
    <input type="text" name="name">
    <input type="submit" name="submit" value="submit">
</form>

Comments

0

That is completely invalid html, you can't nest forms in any version of html

Comments

0

Try adding the word test after function?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.