You need to sign in to do that
Don't have an account?

Multi-Select List
Hey Guys,
Is there a sample of doing a multi-select list in VF just like the built in one where you can move values back and forth between a selected and unselected boxes?
Thanks
All Answers
Personally, I have not done this, but it certainly can be done. There's two ways you can go about this, and the choice is yours.
1) Bind to the existing UI by using the inputField tag.
<apex:inputField value="{!myObject.myMultiSelectField__c}" />
If the field is on an object, just bind to it and Salesforce will automatically oblige you with a complete multi-select mock-up.
2) Roll your own design.
<apex:selectList size="6" multiselect="true" value="{!availableValues}">
<apex:selectOptions value="{!availableValueList}" /></apex:selectList><apex:commandLink action="{!addValues}" reRender="theForm"><apex:image ... /></apex:commandLink><apex:commandLink action="{!removeValues}" reRender="theForm"><apex:image ... /></apex:commandLink><apex:selectList size="6" multiselect="true" value="{!selectedValues}"> <apex:selectOptions value="{!selectedValueList}" /></apex:selectList>
This one requires a custom controller with four get/set methods, two other methods, and a liberal dose of CSS, or at least figuring out Salesforce's CSS classes (not included here for brevity).