I am getting a 'Conversion error setting value' when I try to save a record in my controller extension. The page looks the way I would expect, but when I select one or more checkboxes, it gives my that error. I'm not seeing what the error is here. Thanks for the help.
The page:
<apex:pageBlockSectionItem >
<apex:OutputLabel value="Assigned Areas of Coverage" for="books" />
<apex:selectCheckboxes value="{!selectedBooks}"
layout="pageDirection" id="books">
<apex:selectOptions value="{!options}" />
</apex:selectCheckboxes>
</apex:pageBlockSectionItem>
The controller:
public String[] selectedBooks {get; set;}
public List<SelectOption> options
{
get
{
List<SelectOption> result = new List<SelectOption>();
List<String> optionNames = bookNames(books);
optionNames.sort();
for(String n : optionNames){
if(!blacklist.contains(n)){
result.add(new SelectOption(n, n));
}
}
return result;
}
}
private List<Book__c> books
{
get
{ if (books == null){
books = [select Id, Name from Book__c];
}
return books;
}
set;
}
private List<String> bookNames(List<Coverage__c> coverage)
{
List<String> result = new List<String>();
for(Coverage__c c : coverage){
result.add(c.Book__r.Name);
}
return result;
}
private List<String> bookNames(List<Book__c> books)
{
List<String> result = new List<String>();
for(Book__c b : books){
result.add(b.Name);
}
return result;
}
private List<Id> bookIDs(List<String> bookNames)
{
List<Id> result = new List<Id>();
Set<String> bookNamesSet = new Set<String>(bookNames);
for(Book__c b : books){
if(bookNamesSet.contains(b.Name)){
result.add(b.Id);
}
}
return result;
}