I have a visual force page as below:

<apex:page standardController="Interview__c" extensions="SkillReviewExtension">

  <apex:form >
       <apex:pageBlock title="Candidate Skill Evaluation" id="skills_list">

<apex:pageBlockButtons location="top">
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Edit" action="{!Edit}"/>

      <apex:pageBlockTable value="{! SkillReview }" var="ct" >

       <apex:column value="{! ct.Skill__c}"/>
       <apex:column headerValue="Level">

        <apex:selectList value="{!Level1}" multiselect="false" size="1" rendered="{!isEditMode}">
                <apex:selectOption itemValue="1" itemLabel="1"/>
                <apex:selectOption itemValue="2" itemLabel="2"/>
                <apex:selectOption itemValue="3" itemLabel="3"/>
                 <apex:selectOption itemValue="4" itemLabel="4"/>
                 <apex:selectOption itemValue="5" itemLabel="5"/>

            <apex:outputText value="{!Level1}" label="You have selected:"/>       

       <apex:column headerValue="Description"/>
       <apex:column headerValue="Comments">
       <apex:inputTextarea value="{!inputValue}" id="theTextInput" />





I have a controller extension as below:

public class SkillReviewExtension{

    private final Interview__c review;
    private boolean isEditMode;

public String Level1{get;set;}

 public SkillReviewExtension(ApexPages.StandardController stdController) {
        this.review= (Interview__c)stdController.getRecord();


    public List<Skill_Review__c> getSkillReview() {

        List<Skill_Review__c> results = [SELECT Id,Name,Skill__c FROM Skill_Review__c where Interview__c =:review.id];

        return results;


        public List<SelectOption> getCountriesOptions() {
        List<SelectOption> countryOptions = new List<SelectOption>();
        countryOptions.add(new SelectOption('','-None-'));
        countryOptions.add(new SelectOption('1','1'));
        countryOptions.add(new SelectOption('2','2'));
        countryOptions.add(new SelectOption('3','3'));
        countryOptions.add(new SelectOption('4','4'));
        countryOptions.add(new SelectOption('5','5'));

        return countryOptions;

    public String inputValue {get; set;}

    public PageReference save(){
        return null;

    public PageReference edit(){
        return null;


I am trying to access the varibale named isEdit in my Visualforce page from controller. I can't do this by get and set method. How can the isEditMode variable can be accessed in rendered="isEditMode".

  • what is the reason, you can't make get set isEdit ?
    – Ratan Paul
    Mar 15, 2016 at 17:30
  • Why can't you do by get and set method ? Mar 15, 2016 at 17:30
  • When I use get and set method with this I get an error - Compile Error: Duplicate variable: isEditMode (attempt to re-create the variable with type: boolean) at line 47 column 20
    – SfdcBat
    Mar 15, 2016 at 17:33
  • I am trying to make the input fields and drop down in edit mode when I click edit button and when the VF is saved it should show the text only and not the dropdown or textbox.
    – SfdcBat
    Mar 15, 2016 at 17:35

2 Answers 2


You already did you job just need to modify isEditMode property

Just change private boolean isEditMode;

to public get set this will solve your problem

public  boolean isEditMode {get;private set;}
  • Thanks. I am able to access the variable , but when I click save and referesh the VF page the data I entered during edit is gone, it does not display. Any reason why is that?
    – SfdcBat
    Mar 15, 2016 at 17:53
  • @Rdvsm you are updating isEditMode to false in save method that is the reason..
    – Ratan Paul
    Mar 15, 2016 at 17:57
  • I commented out the isEditMode in my save method, but now I loose the data I entered after I refresh the page. Any idea why?
    – SfdcBat
    Mar 15, 2016 at 18:00
  • @Rdvsm have you checked inputValue in save method ?
    – Ratan Paul
    Mar 16, 2016 at 0:15
  • @Rdvsm if this issue resolved then accept the ans which is useful.
    – Ratan Paul
    Mar 16, 2016 at 2:54

Am I right in thinking that you don't want to use get/set methods because you want the variable to be accessible but not settable?

If you change

private boolean isEditMode;


public boolean isEditMode {get; private set;}

then the variable will be accessible via {!isEditMode} but can only be changed via your save() and edit() methods.

  • Thanks. I am able to access the variable , but when I click save and referesh the VF page the data I entered during edit is gone, it does not display. Any reason why is that?
    – SfdcBat
    Mar 15, 2016 at 17:55
  • What do you want to happen when you click save? When you refresh the page the data will be gone because you are not saving it or retrieving it from any records.
    – Venko
    Mar 15, 2016 at 18:15
  • I would like to save the data I entered when it was in edit mode. How can I retain the data on the page.
    – SfdcBat
    Mar 15, 2016 at 18:18
  • You need to save it to a field on the object it relates to (e.g.) review.some_field__c = inputValue; update review;
    – Venko
    Mar 15, 2016 at 18:19
  • I have a label called comments in my page . I do not have any corresponding object for it. In case I create one where should I place it in VF page? I have - <apex:outputText value="{!inputValue}" /> right now
    – SfdcBat
    Mar 15, 2016 at 18:27

You must log in to answer this question.

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