Jump to content

[SOLVED] submit contents of 2 forms at once --dificult task


snk

Recommended Posts

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()">

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.

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.