An action function
allows an action method from a controller to be executed from JavaScript. The standard Visualforce <apex:actionFunction />
component generates a named function that can be called from any JavaScript code.
In this recipe, we will create a Visualforce page that displays a list of cases and a countdown timer implemented in JavaScript. Once the timer expires, an action method from the page's controller is executed, which redirects the user's browser to the standard case tab.
This recipe makes use of a custom controller, so this must be created before the Visualforce page.
Navigate to the Apex Classes setup page by clicking on Your Name | Setup | Develop | Apex Classes.
Click on the New button.
Paste the contents of the
ActionFunctionController.cls
Apex class from the code download into the Apex Class area.Click on the Save button.
Next, create the Visualforce page by navigating to the Visualforce setup page by clicking on Your...