Newer Version Available
apex:inlineEditSupport
This component provides inline editing support to <apex:outputField> and various container components. In order to support inline editing, this component must also be within an <apex:form> tag.
The <apex:inlineEditSupport> component can only be a descendant of the following tags:
- <apex:dataList>
- <apex:dataTable>
- <apex:form>
- <apex:outputField>
- <apex:pageBlock>
- <apex:pageBlockSection>
- <apex:pageBlockTable>
- <apex:repeat>
See also: the inlineEdit attribute of <apex:detail>
Example
1<!-- For this example to render properly, you must associate the Visualforce page
2
3with a valid contact record in the URL.
4
5For example, if 001D000000IRt53 is the contact ID, the resulting URL should be:
6
7https://MyDomain_login_URL/apex/myPage?id=001D000000IRt53
8
9See the Visualforce Developer's Guide Quick Start Tutorial for more information. -->
10
11<apex:page standardController="Contact">
12 <apex:form >
13 <apex:pageBlock mode="inlineEdit">
14 <apex:pageBlockButtons >
15 <apex:commandButton action="{!edit}" id="editButton" value="Edit"/>
16 <apex:commandButton action="{!save}" id="saveButton" value="Save"/>
17 <apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel"/>
18 </apex:pageBlockButtons>
19 <apex:pageBlockSection >
20 <apex:outputField value="{!contact.lastname}">
21 <apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
22 hideOnEdit="editButton" event="ondblclick"
23 changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
24 </apex:outputField>
25 <apex:outputField value="{!contact.accountId}"/>
26 <apex:outputField value="{!contact.phone}"/>
27 </apex:pageBlockSection>
28 </apex:pageBlock>
29 </apex:form>
30</apex:page>Attributes
| Attribute Name | Attribute Type | Description | Required? | API Version | Access |
|---|---|---|---|---|---|
| changedStyleClass | String | The name of a CSS style class used when the contents of a field have changed. | 21.0 | ||
| disabled | Boolean | A Boolean value that indicates whether inline editing is enabled or not. If not specified, this value defaults to true. | 21.0 | ||
| event | String | The name of a standard DOM event, such as ondblclick or onmouseover, that triggers inline editing on a field. | 21.0 | ||
| hideOnEdit | Object | A comma-separated list of button IDs. These buttons hide when inline editing is activated. | 21.0 | ||
| id | String | An identifier that allows the component to be referenced by other components in the page. | 10.0 | global | |
| rendered | Boolean | A Boolean value that specifies whether the component is rendered on the page. If not specified, this defaults to true. | 21.0 | ||
| resetFunction | String | The name of the JavaScript function that is called when values are reset. | 21.0 | ||
| showOnEdit | Object | A comma-separated list of button IDs. These buttons display when inline editing is activated. | 21.0 |