I have created visualforce page having inline support tag. In this I have one custom picklist field of employee name on which page table gets rerender. And fields in page table are inline editable. But my issues is that it is not getting saved. And unnecessarily drop down list of employee name is getting doubled every time i click on save. Below is my code,

Visualforce Page

    <apex:page standardController="Project__c" extensions="employeeProjectController">
<apex:form >
        <apex:pageBlock title="Employee Project">
            <apex:pageBlockButtons >
                <!--<apex:commandButton value="Edit" action="{!saveProject}" id="editButton" />-->
                <apex:commandButton value="Save" action="{!saveProject}" id="saveButton" reRender="ProjectTable"/>
                <apex:commandButton value="Cancel" action="{!cancel}" id="cancelButton" />

            <apex:selectList multiselect="false" value="{!selectedEmployee}" size="1"  styleClass="picklist" style="left:400px; top:250px;" >
                <apex:actionSupport event="onchange" reRender="ProjectTable" action="{!empProject}"/>
                <apex:selectOptions value="{!EmployeeNames}" />
            <apex:outputPanel id="ProjectTable">
            <apex:pageBlockTable value="{!EmpProject}" var="p" id="PT">

                <apex:column value="{!p.name}" headerValue="Project Name"/>
                <apex:column value="{!p.Status__c}" headerValue="Status"/>
                <apex:column value="{!p.Deadline__c}" headerValue="Deadline"/>
                <apex:column value="{!p.Start_date__c}" headerValue="Start Date"/>
                <apex:column value="{!p.Completed_Date__c}" headerValue="Completed Date"/>
                <apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton"/> 



    public with sharing class employeeProjectController {

public Project__c objProject {get;set;}
public Employee__c objEmployee {get;set;}
public List<Project__c> empProject {get;set;}
public List<employee__c> employeeList {get;set;}
public List<selectOption> options {get;set;}
public String selectedEmployee {get;set;}

    public employeeProjectController(ApexPages.StandardController controller) {
        empProject = new List<Project__c> ();
        employeeList = new List<employee__c> ();
        employeeList = [select id, name from employee__c limit 100];
        empProject = [select id, name,Status__c,Start_date__c,Deadline__c,employee__c ,Completed_Date__c from Project__c limit 100];
        options = new List<selectOption>();
        selectedEmployee = '';

public List<selectOption> getEmployeeNames() {

        options.add(new selectoption('',' - None - '));
    for(employee__c objEmployee : employeeList){

        options.add(new selectoption(objEmployee.id,objEmployee.name));
    return options;

   public void empProject() {
        If(selectedEmployee == null){
            empProject = [select id, name,Status__c,Start_date__c,Deadline__c,employee__c ,Completed_Date__c from Project__c ];
            empProject = [select id, name,Status__c,Start_date__c,Deadline__c,employee__c ,Completed_Date__c from Project__c where employee__c = :selectedEmployee];

    public void saveProject(){

        Project__c empProject= [select id, name,Status__c,Start_date__c,Deadline__c,Completed_Date__c  from Project__c limit 1];
        update empProject;


1 Answer 1


You might have several independent issues

Duplication of picklist values is happening because you are rerendering the full page on save and therefore your method which populates the list is called again and again. Try to rerender only the the panel ProjectTable

<apex:commandButton value="Save" action="{!saveProject}" id="saveButton" rerender="ProjectTable"/>

At your save method you are querying into a new local variable

   Project__c empProject1 = [select id, name,Status__c,Start_date__c,Deadline__c,Completed_Date__c  from Project__c limit 1];
    update empProject1;

Which will save nothing. That's your main issue. You should update empProject here.

And you're fetching your empProject only in your constructor

empProject = [select id, name,Status__c,Start_date__c,Deadline__c,employee__c ,Completed_Date__c from Project__c limit 100];

copy this line right after the update of empProject in case some workflows or triggers might affect the list.

Last thing to mention(look into this only after the above is fixed) there is a bug (or a feature) with inline editing which might affect you too

Inline editing doesn't update last edited value without control loosing focus first


please avoid any local variable. Update first. Then re-query (into the controller property).

public void saveProject(){
    update empProject; // the LIST
    empProject= [select id, name, Status__c, Start_date__c, Deadline__c, Completed_Date__c  from Project__c limit 100]; // into the LIST

  • Hey It worked for duplicate picklist value. But I made changes in save method but still not getting saved. Commented Apr 1, 2015 at 8:50
  • Please update your code in the question above and I will look into it later.
    – Uwe Heim
    Commented Apr 1, 2015 at 9:13
  • Hey I have updated code please look into it. tia Commented Apr 1, 2015 at 9:57
  • done. code suggestion in my answer.
    – Uwe Heim
    Commented Apr 1, 2015 at 10:15
  • 1
    you are mixing up lists and singel objects. Better call lists plural always like empProjects but for the sake of this issue, keep it as it is for now. But try to understand the difference. The LIST is kept in the controller and needs to updated (and optionally requerried). NOT a single local record, which would never work.
    – Uwe Heim
    Commented Apr 1, 2015 at 10:17

You must log in to answer this question.

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