0

I would like to create two buttons, one for activating a checked system user and the other to deactivate a checked system user, but if I use a different function name it doesnt work if I use these two functions it works. Why? is it a must to use them?

function setUpdateAction() {
  document.activate.action = "includes/vendors/activate.php";
  document.activate.submit();
}


function setDeleteAction() {
  document.activate.action = "includes/vendors/deactivate.php";
  document.activate.submit();
}
<form name="activate" method="post" action="">
  <td><input type="button" name="update" value="Activate" onClick="setUpdateAction();"></td> 
  <td><input type="button" name="deactivate" value="Deactivate"  onClick="setDeleteAction();" />
</form>
derekerdmann
  • 17,696
  • 11
  • 76
  • 110

1 Answers1

1

No, function names in JavaScript are arbitrary.

You must, however, make the function names agree in the onClick attribute and the function declaration in your JavaScript. As long as the identifier names are spelled the same, you should be able to name the functions whatever you like within reason.

Community
  • 1
  • 1
amphetamachine
  • 27,620
  • 12
  • 60
  • 72