• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to submit two forms with single submit button  RSS feed

 
abhishek rathur
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

submit two forms
1.<form action="upload.jsp" name="f1" method="post">
2.<form action="upload.jsp" enctype="multipart/form-data" name="f2" method="post">
 
Prasanna Soundarapandiyan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would prefer using a normal button instead of a submit button, and in the java script submit the forms as follows,

<button type="button" onclick="submitForms()"/>

<script type="text/javascript">
function submitForms() {
document.forms["f1"].submit();
document.forms["f2"].submit();
}
</script>

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't submit two forms. Why are you trying to do something like this?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!