snk Posted November 22, 2007 Share Posted November 22, 2007 hello... I have 2 web forms in one page. each form has 1 textfield i want to Post those 2 textfields (they are coming from different web forms) to an other page. Any idea how to get this? thanks Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted November 22, 2007 Share Posted November 22, 2007 try this: <script language="javascript"> function Submit1() { document.form1.submit(); } function Submit2() { document.form2.submit(); } function DoubleSubmit() { setTimeout("Submit1()", 100); setTimeout("Submit2()", 200); } </script> <form name="form1" method="post" action="page1.php" target="_blank"> <input type="text" name="field1"> </form> <form name="form2" method="post" action="page2.php" target="_blank"> <input type="text" name="field1"> </form> <input type="button" value="Submit Data" onclick="DoubleSubmit()"> Quote Link to comment Share on other sites More sharing options...
fenway Posted November 23, 2007 Share Posted November 23, 2007 Why 2 forms? Why not one big form? Quote Link to comment Share on other sites More sharing options...
Dragen Posted November 23, 2007 Share Posted November 23, 2007 Why 2 forms? Why not one big form? I was thinking exactly the same.. Quote Link to comment Share on other sites More sharing options...
snk Posted November 24, 2007 Author Share Posted November 24, 2007 In greece we say.. half knowledge is worse than not knowledge (we mean for a subject) I had no idea how i could manage a web form via javascript. I found it out after a while. Finally i did one big form managing parts with javascript buttons. Thanks for your replies. especially phpquestioner who spent time to answer to my silly question. By the way, great solution. Quote Link to comment Share on other sites More sharing options...
emehrkay Posted November 24, 2007 Share Posted November 24, 2007 Be careful, while that solution works, js' runtime is dependent on the client's machine. Some machines may have a lot going on and never fire the second formsubmit or whatever. Id say put it in one giant form and handle the separation on the server Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.