View Single Post
Old 02-04-2013, 11:59 AM   PM User | #2
niralsoni
Regular Coder

 
Join Date: Mar 2008
Location: London
Posts: 143
Thanks: 3
Thanked 38 Times in 38 Posts
niralsoni is an unknown quantity at this point
html will look something like this (calling two different JavaScript functions on two buttons) -
Code:
<form name="MyForm"> 
.....
.....
<input type="button" value="Save" onclick="return saveData()">
<input type="button" value="Close" onclick="return closePage()">
.....
.....
</form>
Then in the JavaScript function, set the action attribute of form as -
Code:
function saveData() {
  // logic for validating form data etc.
  // if all successful
  {
    MyForm.action = "save.php";
    MyForm.method = "POST";
    MyForm.submit();
    return true;
  }
  return false;
}

function closePage() {
  MyForm.action = "close.php";
  MyForm.method = "POST";
  MyForm.submit();
  return true;
}
Hope it helps you out...

Regards,
Niral Soni
niralsoni is offline   Reply With Quote
Users who have thanked niralsoni for this post:
nani_nisha06 (02-04-2013)