Posts

Showing posts with the label action support

ActionFunction and ActionSupport in Salesforce - When to use what?

Most of the newbies in Salesforce are confused regarding the usage of <apex:actionSupport> and <apex:actionFunction> tags. Lets take a brief overview about what they are and when to use what. <apex:actionSupport> - This component is used when you want to provide AJAX support to a another component. For example, on click of an image , we need to call an apex function. So, in between start tag and end tag of our image, we can put an action support component. We need to specify the javascript event, for example onclick event and the apex action which needs  to be called when this event happens.  <apex:page controller="ActionController">   <apex:form >       <apex:image url="https://login.salesforce.com/img/logo190.png">           <apex:actionSupport action="{!methodInApex}" event="onclick"/>       </apex:image>   </apex:form> </apex:page> public class ActionController {