load combo into dhtmlxform

is there a way to load the combo into dhtmlxform when i use xml to load the structure of the form?

You may try to initialize combo by dhtmlXComboFromSelect method. It allows to use select element (that can be created in form) for combo. However, there is not built-in method to get select obj. You may define it as follows:

[code]dhtmlXForm.prototype.items.select.getSelect = function(item) {
return item.childNodes[0].childNodes[1].childNodes[0];
}

var yourForm = new dhtmlXForm(…);

var selectObj = dhxList.doWithItem(“audioquality”, “getSelect”);

var combo = dhtmlXComboFromSelect(selectObj);
combo.loadXML(url);[/code]

yeah but how does the xml part look like?

Im loading the form like this:

var dhxList = dhxWins.window(id).attachForm(); dhxList.loadStruct("inc/xml/formulieren/nieuwehosting.php");

and the part in: nieuwehosting.php looks like:

echo '<item type="select" name="audioquality" label="Select Audio Quality">'; echo '<option value="1">2.0 16bit/128kbps</option>'; echo '</item>';

Please see sample
dhtmlxForm/samples/01_init/03_init_from_xml.html

it does work now, but when i select 1 of the items out of the result:
i get a javascript error:
‘parentNode.parentNode’ is empty or no object

and how can i use autocomplete mode with this?

form sets “onchange” event handler. And combo inherits this handler which can not be used combo.

You need to remove it before combo inialization:

selectObj.onchange = null;
combo = dhtmlXComboFromSelect(selectObj);

See attached sample
form.zip (73.6 KB)

doesnt work in Firefox, and in IE only when i refresh.
after a while IE needs to be refreshed again before it works.

Make sure that combo is initialized after xml loading

[code]dhxList.loadStruct(“inc/xml/formulieren/nieuwehosting.php”,function(){
var selectObj = dhxForm.doWithItem(“test”, “getSelect”);

selectObj.onchange = null;
combo = dhtmlXComboFromSelect(selectObj);

});[/code]

thanks, its working now, how can i bind the combo? so that i can save the value of it with dhxlist.send?

and is it possible add images when i load the combo with:

var selectObj = dhxListNieuweHosting.doWithItem("KlantID", "getSelect"); selectObj.onchange = null; var combo = dhtmlXComboFromSelect(selectObj); combo.enableFilteringMode(true); combo.setDefaultImage("images/icons/user.png"); combo.loadXML("inc/xml/formulieren/data/postcodezoeker.php");
?

thanks in advance!

You may set bind to hidden input of the (combo combo.DOMelem_hidden_input):

combo.DOMelem_hidden_input.setAttribute(“bind”) = “some_value”;

if combo is initialized from select, “image” type should be set this select before combo initialization:

selectObj.setAttribute(“opt_type”) = “image”;
var combo = dhtmlXComboFromSelect(selectObj);

Hi I was having same problems and corrected them using this topic…
I have form attached to the popup window.
in my form I have one combobox converted from select box and two autocomboboxes

var new_doc_form=new_doc_win.attachForm();
new_doc_form.loadStruct("xml/form.xml?i=2345678",function(){
  var selectObj = new_doc_form.doWithItem("audioquality", "getSelect");
  selectObj.onchange = null;
 
  var combo = dhtmlXComboFromSelect(selectObj);
  combo.setOptionWidth(400);
  combo.loadXML("xml/comb.php");
  
  var combo2 =  combo.setAutoSubCombo("xml/comb1.php","alpha2");
  combo2.setOptionWidth(400);
  
  var combo3 =  combo2.setAutoSubCombo("xml/comb2.php","alpha3");
  combo3.setOptionWidth(400);
  combo3.DOMelem_hidden_input.setAttribute("bind") = "combo3";

This is my xml file

<?xml version="1.0"?>
<items>
<item type="label" label="Ընտրել փաստաթուղթը"/>
    <item type="select" name="audioquality">
      <option value="1">Գլուխ</option>
     </item>
	<item type="label" label="Դասակարգում"/>
	<item type="input" name="folder" bind="folder" label="Խումբ"/>
	<item type="input" name="content" bind="content" label="Անուն"/>
	<item type="button" command="save" value="Submit"/>
  </items>

Everithing was working correctly unless I add blind for combo3

Now I’m geting this error -> ‘this._h2.get[…].state’ is null or not an object.

i assume some_value and opt_type needs to be changed to the name of the select?

Hi,

i assume some_value and opt_type needs to be changed to the name of the select?

opt_type is correct attribute name. See combo documentation:
docs.dhtmlx.com/doku.php?id=dhtm … checkboxes

some_value is the value of bind attribute

combo3.DOMelem_hidden_input.setAttribute(“bind”) = “combo3”;

Sorry there was a typo in my previous answer. Please use:

combo3.DOMelem_hidden_input.setAttribute(“bind”,“combo3”);

We are going to release the beta version of the new form. It will provide the built-in implementation of combo, slider, colorpicker and editor.

Probably beta version will be available in a week or two.

Now it works fine… thanks for solution…

Yes it will be very useful to have all that components in dhtmlx form…