apex:actionSupport

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 hover.

Use this component to get user input for a controller method that does not correspond to a field on an sObject. Only <apex:inputField> and <apex:outputField> can be used with sObject fields.

Example 

1<!--  Page: -->
2<apex:page controller="exampleCon">
3    <apex:form>
4        <apex:outputpanel id="counter">
5            <apex:outputText value="Click Me!: {!count}"/>
6            <apex:actionSupport event="onclick"
7                                action="{!incrementCounter}"
8                                rerender="counter" status="counterStatus"/>
9        </apex:outputpanel>
10        <apex:actionStatus id="counterStatus"
11                           startText=" (incrementing...)"
12                           stopText=" (done)"/>
13    </apex:form>
14</apex:page>
15
16/***  Controller: ***/
17public class exampleCon {
18    Integer count = 0;
19
20    public PageReference incrementCounter() {
21            count++;
22            return null;
23    }
24
25    public Integer getCount() {
26        return count;
27    }
28}

Attributes 

Attribute NameAttribute TypeDescriptionRequired?API VersionAccess
actionApexPages.ActionThe action method invoked by the AJAX request to the server. Use merge-field syntax to reference the method. For example, action=”{!incrementCounter}” references the incrementCounter() method in the controller. If an action is not specified, the page simply refreshes. 10.0global
disabledBooleanA Boolean value that allows you to disable the component. When set to “true”, the action is not invoked when the event is fired. 16.0
disableDefaultBooleanA Boolean value that specifies whether the default browser processing should be skipped for the associated event. If set to true, this processing is skipped. If not specified, this value defaults to true. 10.0global
eventStringThe DOM event that generates the AJAX request. Possible values include “onblur”, “onchange”, “onclick”, “ondblclick”, “onfocus”, “onkeydown”, “onkeypress”, “onkeyup”, “onmousedown”, “onmousemove”, “onmouseout”, “onmouseover”, “onmouseup”, “onselect”, and so on. These values are case sensitive. 10.0global
focusStringThe ID of the component that is in focus after the AJAX request completes. 10.0global
idStringAn identifier that allows the component to be referenced by other components in the page. 10.0global
immediateBooleanA Boolean value that specifies whether the action associated with this component should happen immediately, without processing any validation rules associated with the fields on the page. If set to true, the action happens immediately and validation rules are skipped. If not specified, this value defaults to false. See Use the immediate Attribute Carefully. 11.0global
onbeforedomupdateStringThe JavaScript invoked when the onbeforedomupdate event occurs–that is, when the AJAX request has been processed, but before the browser’s DOM is updated. 11.0global
oncompleteStringThe JavaScript invoked when the result of an AJAX update request completes on the client. 10.0global
onsubmitStringThe JavaScript invoked before an AJAX update request has been sent to the server. 10.0global
renderedBooleanA Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true. 10.0global
reRenderObjectThe ID of one or more components that are redrawn when the result of an AJAX update request returns to the client. This value can be a single ID, a comma-separated list of IDs, or a merge field expression for a list or collection of IDs. 10.0global
statusStringThe ID of an associated component that displays the status of an AJAX update request. See the actionStatus component. 10.0global
timeoutIntegerThe amount of time (in milliseconds) before an AJAX update request should time out. 10.0global

See Also