If you want to display each drop down value with the checkbox you can use the below code snippet.In below code we are using Salesforce tag called <apex:selectCheckboxes> and inside that we are adding all the SelectOptions.
Source Code:
OutPut:
Thanks for visiting..hope this helps you!
Source Code:
In VisualForce Page:
<apex:selectcheckBoxes value="{!selFruits}" > <apex:selectOption itemLabel="Mango" itemValue="Mango" /> <apex:selectOption itemLabel="Apple" itemValue="Apple" /> <apex:selectOption itemLabel="Banana" itemValue="Banana" /> <apex:selectOption itemLabel="Guava" itemValue="Guava"/>
<apex:selectOption itemLabel="Orange" itemValue="Orange"/> </apex:selectcheckBoxes>
In Apex Class:
Public List<String> selFruits{get;set;} // This should be list not Single String
OutPut:
Thanks for visiting..hope this helps you!
No comments:
Post a Comment