Activity Forums Salesforce® Discussions What is the difference between Action support and Action function in Salesforce?

  • shradha jain

    Member
    August 14, 2018 at 8:07 am

    Hello Avnish,

    The difference between Action support and Action function is:

    Action function :

    1.Using Action Function, we can invoke AJAX using Java script .

    2.  It provides support for invoking controller action methods directly from JavaScript code using an AJAXrequest

    3. It is used when we need to perform similar action on various events. Even though you can use it in place of      actionSupport as well where only event is related to only one control.

    Action support:

    1. Using Action Function,we can directly invoke method from controller.
    2. A component that adds AJAX support to another component, allowing the component to be refreshed asynchronously by the server when a particular event occurs, such as a button click or mouseover.
    3. It is used when we want to perform an action on a particular event of any control like onchange of any text box or picklist.
  • shariq

    Member
    September 16, 2018 at 5:46 pm

    Hi,

    apex:ActionFunction : This component helps to envoke AJAX request (Call Controllers method) directly from Javascript method. It must be child of apex:form.
    <apex:actionFunction name=”sendEmail” action=”{!sendEmailFunction}”>

    </apex:actionFunction>

    apex:ActionSupport : This component adds Ajax request to any other Visualforce component. Example : Commandlink button has inbuilt AJAX functionality however few components like OutputPanel does not have inbuilt AJAX capabilities. So with the help of this component, we can enable AJAX.

    <apex:outputpanel id=”counter”>
    <apex:outputText value=”Click Me!: {!count}”/>
    <apex:actionSupport event=”onclick” action=”{!incrementCounter}” rerender=”counter” status=”counterStatus”/>
    </apex:outputpanel>

    Hope his helps.

  • Parul

    Member
    September 16, 2018 at 5:48 pm

    Action Function: Invoke the controller method from java script using AJAX and we can use action function from different places on visual force page.
    Action Support: Invoke the controller method using AJAX when event occurs on page like onMouseOver, onClick, etc. and we can use action support for particular single apex component.

     

     

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos