You need to sign in to do that
Don't have an account?
vickySFDC
What is main use of<apex:actionsupport> and <apex:actionfunction> really confusing?
Hi All,
This two VF tags I am really confusing
Can anyone give examples <apex:actionsupport> and <apex:actionfunction> tags and give some examples?
Thanks,
Vicky
HI
A component that provides support for invoking controller action methods directly from JavaScript code using an AJAX request. An <apex:actionFunction> component must be a child of an<apex:form> component.
Used when we need to perform similar action on varioud events. Een though you can use it in place of actionSupport as well where only event is related to only one control.
Example
.ActionSupport : A component that adds AJAX support to another component, allowing the component to be refreshed asynchronously by theserver when a particular event occurs, such as a button click or mouseover.
Used when we want to perform an action on a perticular eventof any control like onchange of any text box or picklist.
Example
If this post answers your questions please mark it as solved and hit kudos button if it helps you
Thanks
All Answers
HI
A component that provides support for invoking controller action methods directly from JavaScript code using an AJAX request. An <apex:actionFunction> component must be a child of an<apex:form> component.
Used when we need to perform similar action on varioud events. Een though you can use it in place of actionSupport as well where only event is related to only one control.
Example
.ActionSupport : A component that adds AJAX support to another component, allowing the component to be refreshed asynchronously by theserver when a particular event occurs, such as a button click or mouseover.
Used when we want to perform an action on a perticular eventof any control like onchange of any text box or picklist.
Example
If this post answers your questions please mark it as solved and hit kudos button if it helps you
Thanks
* for example call controller onclick of a inputcheck box
* or call a controller method onfocus of a input field
Well, they both do the same thing of calling controller method.
Difference between both:
1. Action function can call the controller method from java script.
2. Action support adds AJAX support to another visualforce component and then call the controller method.
for example:
<apex:outputpanel id="outptpnl">
<apex:outputText value="click here"/>
<apex:actionSupport event="onclick" action="{!controllerMethodName}" rerender="pgblck" />
</apex:outputpanel>
Here action support adds AJAX to output panel, so once you click on output panel controller method will be called.
3. Action function cannot add AJAX support to another component. But from a particular component which has AJAX support(onclick, onblur etc) action function can be called to call the controller method.
Example:
<apex:actionFunction name="myactionfun" action="{!actionFunMethod}" reRender="outptText"/>
<apex:inputcheckbox onclick="myactionfun" />
In this example onlick of input checkbox "myactionfun" action function is called from where controller method "actionFunMethod" gets called.