dhtmlxform + combo send not working

formData = [ ... {type: "checkbox", label: "Text", name:"Test", value: "abc"}, {type: "combo", label: "Package", name: "fetal_heartbeat", value: "", comboType: "checkbox", filtering: "true", options:[ {text: "ясне", value: "1"}, {text: "приглушене", value: "2"}, {text: "ритмічне", value: "3"} ]}, ... {type: "button", value: "Send", name: "send"} ]} ]; myForm = new dhtmlXForm("myForm", formData); myForm.attachEvent("onButtonClick", function(id){ if (id == "send") { myForm.send("php/mirror.php", function(loader, response){ alert(response); }); } });
at response no values of checkbox (true|false) of combo

How to send or save data of checkbox of combo to xml ???


I’m afraid there is no native behaviour for this, you have to add one more item and use it.

extra input in a form:

{type: "hidden", name: "checked", value: ""}

send to server:

myForm.setItemValue("checked", myForm.getCombo(name).getChecked().join(",")); myForm.send("1.php", function(){...});

from server:

myForm.load("1.xml", function(){ var checked = myForm.getItemValue("checked").split(","); var k = {}; for (var q=0; q<checked.length; q++) k[checked[q]] = true; var combo = myForm.getCombo(name); combo.forEachOption(function(option){ combo.setChecked(option.index, k[option.value]==true); }); });


<data> <checked>value1,value2,value5</checked> </data>