Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Stef on May 27, 2009 05:13
open dhtmlx forum
dhtmlxCombo open page after group select

Hi,
I'm a JS noob, but I managed to create a grouped select with external xml files and dhtmlxCombo. It works verry nice!
However ofcourse after selecting something should happen... I want to open a page with the name of the value of selection in z3.
How can I do this?
here is mu code so far:
    <script>
        var z3=new dhtmlXCombo("combo_zone3","alfa4",200);
        z3.loadXML("select_03.php");
        z3.readonly(true);

        var z2=new dhtmlXCombo("combo_zone2","alfa3",200);
        z2.enableFilteringMode(false);    
        z2.attachChildCombo(z3,"select_03.php");
        z2.loadXML("select_02.php")    ;
        z2.readonly(true);
        
        var z=new dhtmlXCombo("combo_zone","alfa2",200, 'image');
        z.enableFilteringMode(false);
        z.attachChildCombo(z2,"select_02.php");
        z.loadXML("select_01.php");
        z.readonly(true);
    </script>

Thanks a lot!
Answer posted by Alex (support) on May 27, 2009 07:19

Hello, 

in this case you can use onChange event handler instead of groups extention. For example:

  var z3=new dhtmlXCombo("combo_zone3","alfa4",200); 
  z3.loadXML("select_03.php",function(){
    z3.setComboValue(some_value)
  }); 
  z3.readonly(true); 

  var z2=new dhtmlXCombo("combo_zone2","alfa3",200); 
  z2.attachEvent("onChange",function(){
  z3.loadXML("select_03.php?parent="+z2.getActualValue())
  }); 
  z2.loadXML("select_02.php") ; 
  z2.readonly(true); 
   
  var z=new dhtmlXCombo("combo_zone","alfa2",200, 'image'); 
  z.attachEvent("onChange",function(){
    z2.loadXML("select_02.php?parent="+z.getActualValue())
  }); 
  z.loadXML("select_01.php"); 
  z.readonly(true);

  

Answer posted by stef on May 27, 2009 07:52
Hi Alex, thank you for the quick reply!

However, there's still no page change after I select the combo box. For example I want to go to the page http://www.test.com/index.php?+"value of z3".
Can you show me how to do this?

Thanks in advance!
Stef

Answer posted by Alex (support) on May 27, 2009 09:30

Possibly something as follows can be used: 

z3.loadXML("select_03.php",function(){

  z3.setComboValue(some_value)

  z3.attachEvent("onChange",doOnChange)

});

function  doOnChange(){ /*this function will be called when the value of z3 combo is changed*/

  document.location.href= "http://www.test.com/index.php?value="+z3.getActualValue();

}


Answer posted by Stef on May 27, 2009 09:59
Thank you Alex!
This is what I need.

regards,
Stef