1

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

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." />
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.