...

View Full Version : Two form actions?



Philip M
05-17-2005, 07:43 PM
Is it allowable to have two actions on submitting the same form, and if so what is the correct syntax, please?

Something like:-

<FORM action="http://mydomain.co.uk/cgi-bin/script1.pl; http://anotherdomain.co.uk/cgi-bin/script2.pl" onsubmit="runascript">

hemebond
05-17-2005, 11:00 PM
Is it allowable to have two actions on submitting the same formNo. It is not.

Philip M
05-18-2005, 08:25 AM
Thanks for the answer.

NancyJ
05-18-2005, 08:43 AM
actually you can have a form that has multiple actions if for example you want your form to have differing actions based on buttons presses.

The first way would be to combine your 2 scripts and have a different part fire depending on which button was pressed.

The second way would be to use javascript to change the forms action onClick of the buttons eg.



<form action = "" name = "formname">
<input type = "submit" name = "script1" Value = "Script1" onClick = "javascript:document.formname.action = 'script1.pl';document.formname.submit();">
<input type = "submit" name = "script2" Value = "Script2" onClick = "javascript:document.formname.action = 'script2.pl';document.formname.submit();">
</form>

Philip M
05-18-2005, 07:35 PM
Thanks NancyJ. Very informative.

I have now found your thread number 53576
which answers my question.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum