Salesforce | How to prevent double click on Apex button

Author - Webner

How to avoid double click on Apex button in Salesforce (after click disable button and enable again once action is complete)?

This is the code having the solution (explained below):

<apex:actionStatus id="saveStatus">
<apex:facet name="stop">
<apex:commandButton value="Go" action="{!go}" status="saveStatus" rerender="saveParentBlock" />
</apex:facet>
<apex:facet name="start">
<apex:commandButton value="Searching..." disabled="true" status="saveStatus"/>
</apex:facet>
</apex:actionStatus>

1. When the user clicks on Go button on visualforce page. runQuery action is called and button is disabled. Now button text changes to “Searching” after click.

2. When the action is complete button is again enabled and text changes to “Go”.

Webner Solutions is a Software Development company focused on developing CRM apps (Salesforce, Zoho), LMS Apps (Moodle/Totara), Websites and Mobile apps. If you need Salesforce customization, App development or any other software development assistance please contact us at salesforce@webners.com

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *

Send your message