DHTMLX Docs & Samples Explorer

FORM integration

Combo can be integrated with form.
The additional element in the submit array - NAME_new_value - gives information about a value: either it has been selected or user added new text. Element is set as "true" when selected value isn't equal to any of the options, else its value is "false"

From select box

From XML

From Javasript

Source
<script>
window.dhx_globalImgPath = "../../codebase/imgs/";
</script> <link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxcombo.css"> <script src="../../codebase/dhtmlxcommon.js"></script> <script src="../../codebase/dhtmlxcombo.js"></script> <h3>From select box</h3> <form target="bframe" action="php/dumpPost.php" method="POST" onsubmit="confirmComboValues()"> <select style='width:200px;' id="combo_zone1" name="alfa1"> <option value="1">a00</option> <option value="2">a01</option> <option value="3">a02</option> <option value="4">a10</option> <option value="5">a11</option> <option value="6">a12</option> <option value="7">b00</option> <option value="8">b01</option> <option value="9">b02</option> <option value="10">b10</option> <option value="11">b11</option> <option value="12">b12</option> <option value="13">a22</option> <option value="14">a31</option> <option value="15">a04</option> </select> <h3>From XML</h3> <div id="combo_zone2" style="width:200px; height:30px;"></div> <h3>From Javasript</h3> <div id="combo_zone3" style="width:200px; height:30px;"></div> <input type="submit" /> </form> <script>
var combos = [];
combos[0] = dhtmlXComboFromSelect("combo_zone1");
combos[1] = new dhtmlXCombo("combo_zone2", "alfa2", 200);
combos[1].loadXML("../common/data.xml");
combos[2] = new dhtmlXCombo("combo_zone3", "alfa3", 200);
combos[2].addOption([[1, 1111], [2, 2222], [3, 3333], [4, 4444], [5, 5555]]);
/*we recommend to use confirmValue on form submit*/
;
function confirmComboValues() {
    for (var i = 0; i < combos.length; i++);
    combos[i].confirmValue();
}
</script> <iframe name="bframe" id="bframe" style="width:1005; height:200px;"></iframe>