While discussing a problem with inlineEdit I came across a interesting bug. The inlineEdit supports show and hide feature actually breaks when a rerender is done.
So here is a sample code
<apex:page standardController="Contact">
<apex:form id="frm" >
<apex:pageBlock mode="inlineEdit" id="pb">
<apex:commandButton value="Rerender" rerender="frm"/>
<apex:commandButton id="editButton" value="Edit"/>
<apex:commandButton id="saveButton" value="Save" style="display: none;"/>
<apex:commandButton id="cancelButton" value="Cancel" style="display: none;"/>
<apex:pageBlockSection >
<apex:outputField value="{!contact.lastname}">
<apex:inlineEditSupport showOnEdit="saveButton,cancelButton"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" />
</apex:outputField>
<apex:outputField value="{!contact.accountId}"/>
<apex:outputField value="{!contact.phone}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
With this code if you directly go ahead and do a inline edit on a field the fields will appear in input mode and the buttons Edit,Save,Cancel will appear and disappear accordingly
So
- Edit Mode : Save Button and Cancel Button
- ReadOnly Move : Edit Button
Now if I press the rerender button(which just rerenders the form) the inline edits "showOnEdit" and "hideOnEdit" will stop working.
Is this is a possible bug ? Or am doing something wrong?