<form onsubmit="return confirm('Are you sure you want to rollback deletion of candidate table?')">
<input type='submit' name='delete' value='Undo' />
<input type='submit' name='no' value='No' />
when the user clicks on second submit button i.e No
i want to display the confirmation dialogue as "Are you sure you want to commit the transaction."
Worked fine. just changed
onsubmit()
toonclick()
. as the function of both in this situation is same.Here's an event-listener based solution that avoids inline event handlers (useful if your site has a Content Security Policy that forbids inline JavaScript):
HTML:
JS:
You could bind to onclick instead of onsubmit - see below.
Or alternately, using jQuery:
I wouldnt try to create a submit but rather just a button that has a onclick="function()" and then use javascript to set a variable to see how many times they have clicked it and a alert();
hope this helps :D
Just use two of the same form. One for each button:
Also, if you would done your research you would find these:
Two submit buttons in one form