Reloading Combo Options from XML

Hello,

I’m trying to reload my combo options from an xml string. Reading the other post, I have used the following:

z.clearAll(true);
z.loadXML(myXMLReturn);

Nothing happens…

When the form initially displays, the combo options are built with no problems. Once I make a selection or change a certain field, I need the combo options to rebuild. Any ideas or help would be greatly appreciated

Hello,

loadXML loads data from the xml file. In case of the string you need to use loadXMLString method:

z.clearAll(true);
z.loadXMLString(myXMLReturn);

Thanks for the reply. I did not explain well enough.

During my initial load, I’m reading an XML return from my server which is formated to the specific “option” format. Once I make a change to a particular edit control, I must send a request back to my server and get a different XML option list. I have used one of your samples to possibly help.

//Test File

Initialization

From XML

clearAll
reload
<script>

    var z=new dhtmlXCombo("combo_zone2","alfa2",200);
	z.readonly(1)
    z.loadXML("../common/data.xml");

</script>
     </div>
</body>

//End Test File

So, loadXML is correct method to load data from xml file. And you may use any server-side script to generate the necessary xml. For example, combo.loadXML(“some.php”);

During the initial load my XML file looks like:

<?xml version="1.0" ?> one two

Now when I want to update, I get errors when trying to update with:

<?xml version="1.0" ?> one-one two-two

It does however work when I update with the following:

z.addOption([[1,1111],[2,2222],[3,3333],[4,4444],[5,5555]])

Regards

Please have a look at the attached sample
combo.zip (17.9 KB)