Activity Forums Salesforce® Discussions How can we add confirmation dialog on the command button in visualforce page?

  • PRANAV

    Member
    September 5, 2016 at 6:05 am

    Hi Mohit,

    I have done is to wrap the return in an if statement and call it only if the condition is correct. The code below will call return if the confirmation is false.

    <apex:commandButton action="{!cancel}" value="Delete" onclick="if(!confirm('Are you sure?')){return false};"/>

    Hope this helps you.

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos