Combobox

Hello.

I’m trying to create a web form to integrate with database tables.

I’ve done the code like this, but there is a problem.



1. I made it to go back to original xml when a user delete the input.

2. When Training module group is selected, it reloads other xmls (machine, software) and reloads the xmls (using sql statement such as “where xxx = $—”).

3. When I use both of them, when Training module is selected and there is no input in Machines, Softwares, and click on one of the Comboboxs it reloads the original xml and don’t show the reloaded one.





//Training module group

var z=new dhtmlXCombo(“trainingmodulegroupcon”,“trainingmodulegroupid”,300);     

    z.enableFilteringMode(true);

    z.loadXML(“autosuggestxmllist.php?op=trainingmodulegroupxml”, true, true);     

    z._def_path=“autosuggestxmllist.php?op=trainingmodulegroupxml”;

z.enableFilteringMode(true, “autosuggestxmllist.php?op=trainingmodulegroupxml&mask=TEXT”, true, true);

z.attachEvent(“onChange”,



function(){

trainingmodulegroupid = z.getSelectedValue();            

if(machineid != “”)

{

z2.loadXML(“autosuggestxmllist.php?op=softwarexml&cat=”+trainingmodulegroupid+"&cat2="+machineid, true, true);

}

else

{

    z2.loadXML(“autosuggestxmllist.php?op=softwarexml&cat=”+trainingmodulegroupid, true, true);

}    

    z3.loadXML(“autosuggestxmllist.php?op=machinexml&cat=”+trainingmodulegroupid, true, true);     

    z2.loadXML(“autosuggestxmllist.php?op=softwarexml”, true, true);

    return trainingmodulegroupid;

    });

    

//Machine name            

    var z3=new dhtmlXCombo(“machineidcon”,“machineid”,300);         

    z3.enableFilteringMode(true, “autosuggestxmllist.php?op=machinexml&mask=TEXT”, true, true);

    z3.loadXML(“autosuggestxmllist.php?op=machinexml”, true, true);     

    z3._def_path=“autosuggestxmllist.php?op=machinexml”;

    z3.attachEvent(“onChange”,

    function(){        

machineid = z3.getSelectedValue();

    if(trainingmodulegroupid != “”){

z2.loadXML(“autosuggestxmllist.php?op=softwarexml&cat=”+trainingmodulegroupid+"&cat2="+machineid, true, true);

}

    else

    {

z2.loadXML(“autosuggestxmllist.php?op=softwarexml&cat2=”+machineid, true, true);

    }

    z2.loadXML(“autosuggestxmllist.php?op=trainingmodulegroupxml&cat2=”+machineid, true, true);                 

    return machineid;

    });



//Software name    

    var z2=new dhtmlXCombo(“softwareidcon”,“softwareid”,300);         

    z2.loadXML(“autosuggestxmllist.php?op=softwarexml”, true, true);

    z2._def_path=“autosuggestxmllist.php?op=softwarexml”;

    z2.enableFilteringMode(true, “autosuggestxmllist.php?op=softwarexml&mask=TEXT”, true, true);

    z2.attachEvent(“onChange”,

    function(){

var softwareid = z2.getSelectedValue();

    z1.loadXML(“autosuggestxmllist.php?op=refcodexml&cat=”+softwareid, true, true);         

    });



Do you have any suggestion for it…? Thanks in advanse.

Just reset the default paths of 2nd and 3rd combo, in onChange event of 1st combo

if(machineid != “”)
{
z2._def_path=“autosuggestxmllist.php?op=softwarexml&cat=”+trainingmodulegroupid+"&cat2="+machineid;
z2.loadXML(z2._def_path, true, true);
}
else
{
z2._def_path=“autosuggestxmllist.php?op=softwarexml&cat=”+trainingmodulegroupid;
z2.loadXML(z2._def_path=, true, true);
}
z3._def_path=“autosuggestxmllist.php?op=machinexml&cat=”+trainingmodulegroupid;
z3.loadXML(z3._def_path, true, true);

return trainingmodulegroupid;
});

Oh, that’s brilliant, I finally could manage to make it work.