var z=new dhtmlXCombo("combo_zone3","alfa3",200);
z.addOption(value,label,css);
value - value of option
label - label of option
css - css string attached to option, optional
It is possible to add few options at once
var z=new dhtmlXCombo("combo_zone3","alfa3",200);
z.addOption([[value,label,css],[value2,label2,css3],[value3,label3,css3]]);
From XML file
var z=new dhtmlXCombo("combo_zone3","alfa3",200);
z.loadXML("xml/data.xml");
Where XML is have next format
Possible attributes of <option> tag:
dhtmlXCombo automatically integrates in surrounding FORM tag.
While submitting such form, there are two form wields will be sent to server side
COMBONAME - value of combobox
COMBONAME_new_value - true if value is text entered in combobox, false if value one of items from predefined list. of combobox
If grid will be initialized by next command
var z=new dhtmlXCombo("combo_zone3","alfa3",200);
server side script will receive fields with names "alfa3" and "alfa3_new_value"
dhtmlXCombo can work in filtering mode. In such mode the values in list filtered by current entered text in edit control.
To enable filtration next command can be called
z.enableFilteringMode(true);
By default combobox uses options which already loaded in it, but it is possible to define the external script
which will be called for generating list of suggestion.
z.enableFilteringMode(true,"php/complete.php",cache);
php/complete.php - path to script
cache - true/false - enable/disable caching of script responses ( using "true" recommended )
In described situation, for each change of text in edit control the next url will be called
php/complete.php?pos=0&mask=TEXT
TEXT - current text in edit control
The combobox awaits that script response will be a XML in same format which used for initialization.
If you prefer - you can return only part of suggestion, combobox can automatically send additional request and add more data to list of options.
z.enableFilteringMode(true,"php/complete.php",cache,true);
The server side script will be called by url
php/complete.php?pos=START&mask=TEXT
START - position from which suggestion must be returned.
For all additional sub fetches returned XML must have "add" attribute of main tag
...