...

View Full Version : submit form ..multiple actions



sir pannels
06-20-2008, 11:25 AM
hi all,

I have been using document.myform.submit(); onClick to submit a form however now I need the submit 1 form to 3 different places... I have three click buttons and I need the form action to be different depending on which button has been clicked.. does any one have any links or info on this?

many thanks

Philip M
06-20-2008, 11:38 AM
Yopu can set the form action dynamically.

function submit1() {
document.myform.action = destination1;
myform.submit();
return true;
}
function submit2() {
document.myform.action = destination2;
myform.submit();
return true;
}
function submit3() {
document.myform.action = destination3;
myform.submit();
return true;
}


The three functions being called onclick from the three buttons respectively. onclick = "return submit1()" etc.

Naturally Javascript must be enabled for this to work.

sir pannels
06-20-2008, 12:05 PM
Philip, thanks. very useful :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum