I am trying to mark selected values in a MutliSelect list but nothing is selected when the page loads even though I have selections made.
Visualforce page:
<select class=" select" size="6" aria-describedby="" multiple="true" value="{!SelectVals}">
<apex:repeat value="{!PickListValuesIntoList}" var="string" id="theRepeat">
<option label="{!string}" />
</apex:repeat>
</select>
Controller:
public List<String> PickListValuesIntoList;
public List<String> SelectVals;
public List<String> getPickListValuesIntoList(){
List<String> pickListValuesList= new List<String>();
Schema.DescribeFieldResult fieldResult = Opportunity.Products_To_Price__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for( Schema.PicklistEntry pickListVal : ple){
pickListValuesList.add(pickListVal.getLabel());
}
return pickListValuesList;
}
public List<String> getSelectVals(){
list<string> tempSelectVals = new list<string>();
tempselectvals = ThisOpportunity.Products_to_Price__c.split(';');
return tempselectvals;
}