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
s_macs_mac 

Action function vs Command button

Can somebody please explain me what is the difference between calling a method in apex class from command button and calling an apex class method from javascript



Thanks in Advance...
bob_buzzardbob_buzzard
There's no difference from the Apex side. The difference is all in the front end markup. A commandbutton allows you to call an apex action method when the button is pressed, but under no other circumstances. An actionfunction allows you to execute an apex action method via JavaScript and can thus be used in a number of different scenarios. You could emulate a command button via a regular HTML button with an onclick handler that invokes an actionfunction, but the commandbutton standard component means you don't have to!