Salesforce: ActionStatus with disabled button and “processing” image. 100% on-platform.


This awesome little coding tip is courtesy of l-dawg (not his real name) and very useful. We’ve read lots about how cool ActionStatus’ can be but he’s discovered a way to disable the button that initiates the action, add in a nice little .gif to show progress, and all of this 100% in Visualforce. No static resources, no javascript just good ol’ Visualforce loving. The code goes a little something like this:


<apex:page standardController="Account">

  <apex:form>
      <apex:pageblock title="Account">
       <apex:actionStatus id="mySaveStatus1">
         <apex:facet name="stop">
             <apex:commandButton value="Save Mappings" action="{!save}" rerender="dummy" status="mySaveStatus1"/>
         </apex:facet>
         <apex:facet name="start">
             <apex:outputPanel >
                   <apex:image value="/img/loading32.gif" style="height: 15px;"/>
                   <apex:commandButton value="Processing..." status="mySaveStatus1" disabled="true"/>
               </apex:outputPanel>
           </apex:facet>
        </apex:actionStatus>
      </apex:pageblock>
  </apex:form>

</apex:page>

And the result is a button that goes from this:

To this:

Tagged , , ,

3 thoughts on “Salesforce: ActionStatus with disabled button and “processing” image. 100% on-platform.

  1. sankyforce says:

    excellent…was searching exactly this for a long time

  2. Kirill Yunussov says:

    this is pretty awesome!

  3. Dani says:

    AWESOME!!! Thank you Master!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: