You need to sign in to do that
Don't have an account?

Visualforce inline edit save behaviour inconsistent.
I've created a really simple custom object (Colin__c) with a few text, picklist and checkbox fields. I've created a simple VF page with inline editing on the fields.
Now, depending on what I do between filling in a value in the field and clicking the Save button, it will affect whether the new value is saved or not.
<apex:page id="P1" standardController="Colin__c" > <apex:form id="F1" > <apex:sectionHeader title="{!Colin__c.Name}" /> <apex:PageBlock id="PB1"> <apex:pageMessages /> <apex:pageBlockButtons id="PBB" location="both"> <apex:commandButton id="inlineEditSave" value="Save" action="{!save}" style="display:none"/> <apex:commandButton id="inlineEditCancel" value="Cancel" action="{!cancel}" style="display:none"/> <apex:commandButton id="editButton" value="Edit" action="{!edit}"/> <apex:commandButton id="deleteButton" value="Delete" action="{!delete}" onclick="if ((Modal.confirm && Modal.confirm('Are you sure?')) || (!Modal.confirm && window.confirm('Are you sure?'))) {return true;} else {return false;}"/> </apex:pageBlockButtons> <apex:pageBlockSection id="PBS" title="Details" columns="2"> <apex:inlineEditSupport event="ondblclick" showOnEdit="inlineEditSave,inlineEditCancel" hideOnEdit="deleteButton,editButton" resetFunction="resetInlineEdit"/> <apex:outputField id="cli02" value="{!Colin__c.Text02__c}"/> <apex:outputField id="clc02" value="{!Colin__c.Checkbox02__c}"/> <apex:outputField id="cli03" value="{!Colin__c.Text03__c}"/> <apex:outputField id="clc03" value="{!Colin__c.Checkbox03__c}"/> <apex:outputField id="cli04" value="{!Colin__c.Text04__c}"/> <apex:outputField id="clc04" value="{!Colin__c.Checkbox04__c}"/> <apex:outputField id="clp01" value="{!Colin__c.Picklist01__c}"/> <apex:outputField id="clp02" value="{!Colin__c.Picklist02__c}"/> </apex:pageBlockSection> </apex:PageBlock> </apex:form> </apex:page>
So if I double click on the text field, amend value, hit enter. The text turns orange and I get the undo icon as expected. But when I click Save, the value goes back to its OLD value!
If I double click on the text field, amend value, click Save (with the cursor still in the field), the value is updated.
Why does the way I amend the value affect whether the value saves or not?
It is not the behaviour of inline edit in standard page layouts.
Or am I coding my inline edit incorrectly? Can you see anything unusual?
Hi Colin,
No, there is no any coding error. There seem to still have a problem with the InlineEditSupport component because the example of salesforce doc has the same issue.
Check this link
http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_inlineEditSupport.htm
I have another approach for inline editing in VF. If you want notify me.
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
All Answers
Hi Colin,
No, there is no any coding error. There seem to still have a problem with the InlineEditSupport component because the example of salesforce doc has the same issue.
Check this link
http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_inlineEditSupport.htm
I have another approach for inline editing in VF. If you want notify me.
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
Hi Chamil,
Thanks for the link. I have raised a case (I wrote that it is definitely a bug) with SF through my developer org but I don't know how seriously they look at obvious bugs in VF. I cannot imagine how this got through testing.
I have, for now, decided not to use any in-line editing in my VF page as the thought that only half the updated fields on a page might actually be comitted to the database is unacceptable. Perhaps it will be fixed in the next release.
regards
Colin.
Hi Colin,
I have another approach for inline editing in visualforce page. I will post the example code for Contact object. It will work with custom objects as well.
Visualforce page
controller
Try with this.
No more unfortunate for inline editing on visualforce pages :smileyhappy:
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
Thanks Chamil,
I hope people can make use of this.
Best Regards.
For others looking at this I needed to remove the rerender="employeeList from the edit link to get this to work, but otherwise a great post thanks very much!
Br