Newer Version Available

This content describes an older version of this product. View Latest

Use the immediate Attribute Carefully

Visualforce components with the immediate attribute set to true execute an action without processing any validation rules for the associated fields on the page. This attribute should only be used if the component executes an action that navigates away from the page after completion.

Functional problems occur when the component behavior includes more than basic navigation functionality. Because immediate="true" doesn’t update the page's data model, the page's data model won't reflect any changes made during the action. This discrepancy can cause undefined behavior and possible data corruption.

Use of the immediate attribute is recommended only for cancellation actions. The following example shows an appropriate use of this attribute. When the user clicks Cancel, the <apex:CommandLink> component immediately performs cancelApplication without requiring the user to fix validation errors.

1<apex:CommandLink action="{!cancelApplication}" value="Cancel" styleClass="btn" id="btnCancel" immediate="true">