function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AidenAiden 

How can I mimic Salesforce command button actions?

If I go into Salesforce Accounts, and click Save, the command buttons instantly go grey giving the user great feedback that the button has been pressed. 

 

How can I mimic this Salesforce functionality using the Apex:CommandButton? I tried changing the button via controller, but anything I do here suffers from client to server latency. thanks!

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

You can do this via javascript - create a method that locates the buttons you are interested in and sets them to disabled.  Then add onclick handlers to each button that invokes the javascript.

 

If you are allowing the users to quicksave (i.e. save and stay on the same page) then an actionstatus with onstart/onstop handlers can be used to disable the buttons when the request is posted, and then enable them again when it is complete.

All Answers

bob_buzzardbob_buzzard

You can do this via javascript - create a method that locates the buttons you are interested in and sets them to disabled.  Then add onclick handlers to each button that invokes the javascript.

 

If you are allowing the users to quicksave (i.e. save and stay on the same page) then an actionstatus with onstart/onstop handlers can be used to disable the buttons when the request is posted, and then enable them again when it is complete.

This was selected as the best answer
AidenAiden

thanks!