i want to use javascript to figure out which submit button has been pressed, cancel or update, before i run the form validation onsubmit.. i.e. html <form .. onsubmit="checkcomplete()"> <input type="submit" value="cancel"> <input type="submit" value="update"> ..... </form> Code (markup): javascript pseudo function checkcomplete { if cancel button clicked return false else return results of form validation tests } Code (markup): any way to determine which button has been pressed?
You can do the following <input type="submit" value="Cancel" onclick="checkcomplete('Cancel');"> <input type="submit" value="Update" onclick="checkcomplete('Update');"> Code (markup):
so i would than remove the onsubmit from the form tag? would the result of the checkcomplete function still determine whether or not the form is submitted? or would it simply do the check than submit regardless? you have given me an idea though.. if the onclick of the button works before the onsubmit of the form i could call a function to set a variable to either cancel or confirm and use that in the checkcomplete function. anyways, thanks for the help