function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Admin1112Admin1112 

How to Pass multi selected Checkbox values from visualforce page to a multiselect picklist Field

getting unknown property error when saving the vf page.

 

controller

 

public class sosSurvey {

   public Boolean selected { get; set; }
   public String Strength { get; set; }
   public String value { get; set; }

 
 public List<SelectOption> Items {
            get {
                List<SelectOption> options = new List<SelectOption>();
                
Schema.DescribeFieldResult dfr = SOSSurveys__c.strength_against_our_competition__c.getDescribe();
List<Schema.PicklistEntry> pickListEntries = dfr.getPicklistValues();
                                            
                return options;
            }
        }
 
    public String getStrength() {
        return Strength;
    }
 
    public void setStrength(String strength) {
        this.Strength = Strength;
    }
}

 

 

--------------

 

vf page

 

 

<apex:pageBlockSectionItem >
 <apex:outputLabel value="2)What do you think is our strength against our competition ?"/>
  <apex:selectCheckboxes value="{!SOSSurveys__c.strength_against_our_competition__c}">
<apex:selectOptions value="{!Items}"/>
</apex:selectCheckboxes >
 </apex:pageBlockSectionItem>

 

 

 

Avidev9Avidev9
Well not sure why the error is coming up.

Anyways some modification try removing

public String getStrength() {
return Strength;
}

public void setStrength(String strength) {
this.Strength = Strength;
}

because you already defined them using this line
public String Strength { get; set; }
Admin1112Admin1112

Hi I tried,

 

Tried your steps still getting same error whiel saving VF page Unknown property sosSurvey.SOSSurveys .

 

controller  :

 

public class sosSurvey {


public String Strength { get; set; }


public List<SelectOption> Items {
get {
List<SelectOption> options = new List<SelectOption>();

Schema.DescribeFieldResult dfr = SOSSurveys__c.strength_against_our_competition__c.getDescribe();
List<Schema.PicklistEntry> pickListEntries = dfr.getPicklistValues();

return options;
}
}


}

 

------

 

vf page

 

 

<apex:pageBlockSectionItem >
<apex:outputLabel value="2)What do you think is our strength against our competition ?"/>
<apex:selectCheckboxes value="{!SOSSurveys__c.strength_against_our_competition__c}">
<apex:selectOptions value="{!Items}"/>
</apex:selectCheckboxes >
</apex:pageBlockSectionItem>