I have this code with inline edit support.
When I hit save the changes are not saved – I see that the currentCatalogItem which is sent to be updated does not have the value I changed.
What am I doing wrong?
Page:
<apex:commandButton action="{!saveCatalogItem}" id="saveButton" value="Save" style="display:none"/>
<apex:pageBlockSection columns="2">
<apex:outputField value="{!Portfolio_Catalog_Item__c.edit_Short_Name__c}">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton" event="ondblclick" hideOnEdit="editButton, approveButton, deleteButton, cloneButton" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
</apex:outputField>
<apex:pageBlockSection columns="2">
Controller Extension:
public pageReference saveCatalogItem() {
try {
update currentCatalogItem;
}
catch(Exception e){
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, e.getMessage()));
}
return null;
}
Best Answer
I have also faced the same issue. You can resolve this by first changing the focus of the Inline Edit to some other element (say a hidden input type). This will send your updated value back to the controller.
Try the below updated code.
Page:
Controller Extension:
Hope this helps.