How to use combo with checkboxes in form


I want to use the combobox in forms, but have the selection list with checkboxes.
If I use combo by itself this is no problem but how do I integrate this functionality in form ?

I already have the combobox and the extra libraries but now it’s only a matter of getting the checkboxes in the list.

I’m using 3.6 (non-pro).
The stand alone version uses xml, but I’d like to initialize with a list from the form in json.


The structure is the next:

formData = [ {type: "combo", label: "Combo", comboType: "chaeckbox", name: "mycomb", width: 200} ];

Hi Darya,

That does work, thank you !
Is this anywhere in the documentation ?


We will update documentation with new version release in the end on May - it will be there

Another (related) question :

How do I tick the checkbox using the json data ?

Both :
$data[“selected”] = true;
$data[“checked”] = true;

don’t work…

Cheers !

How are you going to load combo options?

Like this :

[ {"comboType" :"checkbox" ,"type" :"combo" ,"name" :"RETURNACTION_Data" ,"inputWidth" :"150" ,"offsetTop" :2 ,"offsetLeft" :0 ,"inputHeight" :22 ,"options" : [ {"value" :"Archive" ,"text" :"Archive" } , {"value" :"Fail" ,"text" :"Fail" ,"selected" :true ,"checked" :true } , {"value" :"Delete" ,"text" :"Delete" ,"selected" :true ,"checked" :true } ] } ]

Both ‘selected’ and ‘checked’ don’t do anything…

You need to get combo
and use dhtmlxCombo method setChecked() to check the items you need

That’s how I solved it for now.

But hopefully you’ll agree this should be possible in the json file as well.
Otherwise it sort of defeats the purpose of preparing the file on the server and having to build something on the client side just to tick a few options.
(On the server side you’ll know which ones to tick)

The ‘form’ (single) selectbox works like this with json.
I think it should be transparent to the user where it actually comes from (ie if it’s a separate module).

Maybe this can be (more) integrated in the 4.0 release ?



4.0 will allow you to use checked:true on init stage, i.e.

{type: "combo", comboType: "checkbox", ..., options: [ {value: "a", text: "Option A", selected: true, checked: true}, {value: "b", text: "Option B", checked: true}, {value: "c", text: "Option C"} ]}

<item type="combo" comboType="checkbox" ... > <option value="a" text="Option A" selected="true" checked="true"/> <option value="b" text="Option B" checked="true"/> <option value="c" text="Option C"/> </item>

If you need this functionality for current 3.6 please provide completed demo including all corresponding js/css files and I will add it. also you can send your demo to (please include link to this thread)

Thanx, I can hold my breath till 4.0 :slight_smile:

This way I am creating the combobox and it works perfectly, I am loading the data from mysql
i use this:

var h = new dhtmlXComboFromSelect(“comboBox”);

I am reading about the issue of combobox, but I do not know how to integrate what I did to make it to checkbox, and then as I do to know what options are marked, I know it’s with getChecked () but a small example would solve my doubts

Here you can find a working example of the combo with checkboxes initialized from the select: … boxes.html
You need to call the getChecked() method to get all the checked options: … ecked.html