function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sampath kumar 3sampath kumar 3 

How to create a checkbox in picklist

Can anyone tell me how to create a checkbox in picklist using Apex and Visualforce page . As per my knowledge  in Apex will create a list of

I want this Functionality
selectOption and this will accept only string ,this selectOption will pass to the visualforce selectoption but how to add checkbox .As per the above image i need to add string along with checkbox in my picklist
Pramodh KumarPramodh Kumar
Hi Sampath,

I wrote some small code for your scenario, here is the code snippet

VFpage
<apex:page controller="multiSelectPicklist">
    <apex:form >
        <apex:repeat value="{!listOfPicklist}" var="list">
            <li>
            <apex:inputcheckbox value="{!list.selected}"/>
            {!list.picklistString}
            </li>
        </apex:repeat>
    </apex:form>
</apex:page>
Controller
public class multiSelectPicklist {
    public list<picklistClass> listOfPicklist{get;set;}
    
    public multiSelectPicklist(){
        listOfPicklist = new list<picklistClass>();
        picklistClass tempPicklist;
        for(double i=1;i<=4;i++){
            tempPicklist = new picklistClass();
            tempPicklist.picklistString =i +' String';
            listOfPicklist.add(tempPicklist);
        }
        
        
    }

    public class picklistClass{
        public boolean selected{get;set;}
        public string picklistString{get;set;}
    }
}
User-added image
Please let me know if you need any other help.



Thanks,
Pramodh.
Arun Deepan LJArun Deepan LJ
Hi, For such scenarios, You need to take help of the jQuery libraries such asj Kendo, Angular ... With default visual force functionality you cannot create such picklist.

http://demos.telerik.com/kendo-ui/multiselect/index
You need implement in such ways
sampath kumar 3sampath kumar 3
@pRAMODH : I understand your logic but I would like to display in a picklist any ways