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
dbelwooddbelwood 

SelectCheckboxes component issue

Hello,

 

I've got a selectcheckboxes component on a VF page;

<apex:pageBlockSection title="Product" columns="2">

<apex:pageBlockSectionItem >

<apex:outputText value="{!$ObjectType.Household_Search__c.fields.PolicyType__c.label}"/>

<apex:selectCheckboxes value="{!policyTypes}" layout="pageDirection">

<apex:selectOptions value="{!policyTypeOptions}"/>

</apex:selectCheckboxes>

</apex:pageBlockSectionItem>

 

And the  associated controller;

 

// Multi-select search properties

public List<String> policyTypes {get;set;}

public List<SelectOption> policyTypeOptions {get{return getOptions(Household_Search__c.PolicyType__c.getDescribe());}}

 

private List<SelectOption> getOptions(Schema.DescribeFieldResult f) {

List<SelectOption> options = new List<SelectOption>();

for (Schema.PicklistEntry entry : f.getPicklistValues()) {

options.add(new SelectOption(entry.getLabel(), entry.getValue()));

}

return options;

}

 

When I save the page, I'm receiving the following error; 

Conversion Error setting value 'AUTO LIFE' for '#{policyTypes}'.
  

 

 

Any ideas?

 

Many thanks,

Dan 

 

 


 

bob_buzzardbob_buzzard
I think you need to swap the parameters passed to the SelectOption constructor - value first then label.