Unable to edit a custom object in VF.

Here is my controller

public class dataTableCon {

List<Feedback__c> fb;
List<Feedback_Comment__c> fbc;
public List<Feedback__c> getAccounts() {
    if(fb== null) fb= [select Name, Description__c, Importance__c, Resolution__c,  Status__c, Owner.name from Feedback__c];
    return fb;

 public PageReference save()
  return null;
 public PageReference cancel()
  return null;


Here is my VF..

   <apex:dataTable value="{!accounts}" var="account" id="theTable" bgcolor="lightyellow" border="5">
      <apex:column >
             <apex:facet name="header">Description (editable)</apex:facet>
            <apex:inputtext value="{!account.Description__c}" size="100" id="PanelId"/>

which has...

    <apex:inlineEditSupport event="onclick" showOnEdit="btnSave,btnCancel"  />
    <apex:commandButton value="Save" action="{!save}" id="btnSave"/>
    <apex:commandButton value="Cancel" action="{!cancel}" id="btnCancel" reRender="PanelId" />

I can edit on the Description__c field but when on page refresh loses then new contents.

Please suggest.


  • In your Save() method you have to upsert your fb list. Is this a mistake while posting or you really missing it?
    – highfive
    Apr 18, 2014 at 14:27
  • I didn't do it. After I changed as public PageReference save() { upsert fb; return null; } Its working :) Thanks
    – MnZ
    Apr 18, 2014 at 14:34

1 Answer 1


When you bind controller(back-end) data with a visualforce page(client side) you need to maintain the relationship correctly wherever you want, so that your page showing the updated values and database will be updated with the correct values.

You have brought the data into client side correctly but sending back to the database is missing. Add following line into your Save() method.

upsert fb;

If you are having multiple fields where some are just controller variables(not from database), some are from different objects, it's always good to have a wrapper class and bind a list of wrapper instance into the client side.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .