In my vf page, there is a save button that of standard vf command button. A JS confirm will popup when someone click this button. Now, if user has chosen cancel, I want to cancel the action of save. So how can I do it?
1 Answer
You just need to return false in the Javascript and the execution will stop.
Another example (using standard JS confirm popup)
<apex:commandButton action="{!doSomething}" onclick="return confirm('Really?');" value="Do an action." />