I have a form with many fields and 2 submit buttons. I want to run a different check depending on which submit button i click on. I tried writing the code below but it is wrong (i dont know JS) and nothing happens (bad syntax?). How do i figure out which of the two buttons was clicked?
document.getElementById('sub1').onclick = checkForm;
document.getElementById('sub2').onclick = checkForm;
function checkForm(e)
{
var e = e || window.event;
var o = e.srcElement || e.originalTarget;
if(o.id=="sub1")
return checkNotNull();
else
return checkSamePass();
}