
How to use apex:actionFunction and apex:actionStatus in Salesforce Visualforce Page?
How to use apex:actionFunction and apex:actionStatus in visualforce page ?
"apex:actionFunction :
It provides support for calling an apex method from JavaScript code using an AJAX request. An <apex:actionFunction> component must be a child of an <apex:form> component. An apex:actionFunction cannot be placed inside an iteration component <apex:pageBlockTable>, <apex:repeat>." [1]
"apex:actionStatus :
A component that displays the status of an AJAX update request. An AJAX request can either be in progress or complete." [2]
A snippet of code for the Salesforce Visualforce Page :
A snippet of code for the Salesforce Apex Controller :
Here are some screenshots which are showing our apex:actionFunction and apex: actionStatus. We have embedded our Visualforce Page in a section on an opportunity. The page will look like below screenshot :
On click of 'Update Opportunity' button, an apex action will call that update the opportunity.
Here is a video that shows the working of apexfunction :
Look into the video before the click of 'Update Opportunity' button the opportunity name was 'Test opportunity' and after a click of the button the name update to 'Update Name'.
Resources:
(1) http://sfdcsrini.blogspot.com/2014/06/how-to-use-apexactionfunction-in.html
(2) https://developer.salesforce.com/forums/?id=906F0000000kCGDIA2
Responses