Newer Version Available
apex:actionRegion
An area of a Visualforce page that demarcates which components should be processed by the Force.com server when an AJAX request is generated. Only the components in the body of the <apex:actionRegion> are processed by the server, thereby increasing the performance of the page.
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:outfield can be used with sObject fields.
Note that an <apex:actionRegion> component only defines which components the server processes during a request—it doesn’t define what areas of the page are re-rendered when the request completes. To control that behavior, use the rerender attribute on an <apex:actionSupport>, <apex:actionPoller>, <apex:commandButton>, <apex:commandLink>, <apex:tab>, or <apex:tabPanel> component.
See Also: Using the transient keyword
Example
1<!-- For this example to render fully, associate the page
2with a valid opportunity record in the URL.
3For example: https://Salesforce_instance/apex/myPage?id=001D000000IRt53 -->
4
5<apex:page standardController="Opportunity">
6 <apex:form >
7 <apex:pageBlock title="Edit Opportunity" id="thePageBlock" mode="edit">
8
9 <apex:pageBlockButtons >
10 <apex:commandButton value="Save" action="{!save}"/>
11 <apex:commandButton value="Cancel" action="{!cancel}"/>
12 </apex:pageBlockButtons>
13
14 <apex:pageBlockSection columns="1">
15 <apex:inputField value="{!opportunity.name}"/>
16 <apex:pageBlockSectionItem>
17 <apex:outputLabel value="{!$ObjectType.opportunity.fields.stageName.label}"
18 for="stage"/>
19 <!--
20 Without the actionregion, selecting a stage from the picklist would cause
21 a validation error if you hadn't already entered data in the required name
22 and close date fields. It would also update the timestamp.
23 -->
24 <apex:actionRegion>
25 <apex:inputField value="{!opportunity.stageName}" id="stage">
26 <apex:actionSupport event="onchange" rerender="thePageBlock"
27 status="status"/>
28 </apex:inputField>
29 </apex:actionRegion>
30 </apex:pageBlockSectionItem>
31 <apex:inputfield value="{!opportunity.closedate}"/>
32 {!text(now())}
33 </apex:pageBlockSection>
34
35 </apex:pageBlock>
36 </apex:form>
37</apex:page>Attributes
| Attribute Name | Attribute Type | Description | Required? | API Version | Access |
|---|---|---|---|---|---|
| id | String | An identifier that allows the component to be referenced by other components in the page. | 10.0 | global | |
| immediate | Boolean | A 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. | 11.0 | global | |
| rendered | Boolean | A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true. | 10.0 | global | |
| renderRegionOnly | Boolean | A Boolean value that specifies whether AJAX-invoked behavior outside of the actionRegion should be disabled when the actionRegion is processed. If set to true, no component outside the actionRegion is included in the AJAX response. If set to false, all components in the page are included in the response. If not specified, this value defaults to true. | 10.0 | global |