You need to sign in to do that
Don't have an account?
birdofprey
Going from Multi picklist to dropdown
This is an example which comes directly from the doc. When i just set "size=1" to get my drop down, the "test" button doesn't get involve.
public class sampleCon { String countries; ... public String getCountries() { return countries; } public void setCountries(String countries) { this.countries = countries; } }
public PageReference test() { system.debug('countries===>' + countries); return null; } public List<SelectOption> getItems() { List<SelectOption> options = new List<SelectOption>(); options.add(new SelectOption('US','US')); options.add(new SelectOption('CANADA','Canada')); options.add(new SelectOption('MEXICO','Mexico')); return options; } public String[] getCountries() { return countries; } public void setCountries(String[] countries) { this.countries = countries; } }
<apex:page controller="sampleCon"> <apex:form> <apex:selectCheckboxes value="{!countries}" size="1"> <apex:selectOptions value="{!items}"/> </apex:selectCheckboxes><br/> <apex:commandButton value="Test" action="{!test}" rerender="out" status="status"/> </apex:form> <apex:outputPanel id="out"> <apex:actionstatus id="status" startText="testing..."> <apex:facet name="stop"> <apex:outputPanel> <p>You have selected:</p> <apex:dataList value="{!countries}" var="c">{!c}</apex:dataList> </apex:outputPanel> </apex:facet> </apex:actionstatus> </apex:outputPanel> </apex:page>
Since multipick is now false, So figure that I have to change the set and get to accept string and not string[];
Now i get this error:
SampleCon Compile Error: The method void setCountries(LIST<String>) is referenced by Visualforce Page (sampleCon) in salesforce.com