Forum Moderators: open
Here's the problem:
I have form elements inside two different <div>s. So in order to do that, I had make each <div> have it's own <form> surround the form elements. But I want to be able to click ONE submit button and have it submit ALL the form elements on the page, as though they were all INSIDE THE SAME <form>.
any ideas?
<form name='form2' action='process.php' onsubmit=somefunction2() >
<input type='hidden' name='username' id='username2' />
<input type='text' name='surname' id='surname2' />
</form>
I hope this helps you
Good luck!
I am somewhat confused by your post:
I have form elements inside two different <div>s. So in order to do that, I had make each <div> have it's own <form> surround the form elements
Why would you have to do this? You can certainly wrap both divs in a single form:
<form method="post" action="duh.htm">
<div id="div1">
<input type="text" size="20" id="txtOne" name="txtOne" />
</div>
<div id="div2">
<input type="text" size="20" id="txtTwo" name="txtTwo" />
</div>
</form>
If there is some other reason for needing two forms, you could put each form on a separate html page and put each page in an iframe on a container page. That way you could have one button on the container page submit the forms in each of the documents contained in the iframes.
ajkimoto