Help with combogroups in scheduler

Hi all,
I have this code for my goal:

[code]scheduler.form_blocks["combo_select"]={
      render:function(sns){
         var html="<div class='dhx_cal_ltext'><table><td><div id='c1' style='height:10px;'></div></td><td><div id='c2' style='height:10px;'></div></td><td><div id='c3' style='height:10px;'></div></td><td><div id='c4' style='height:10px;'></div></td></table></div>";
         return html;

      },

      set_value:function(node,value,ev){
      if (!this._node_init){

         node.combo1 = new dhtmlXCombo("c1", "c1", 150);
         node.combo1.loadXML("php/category.php");
         node.combo2 = new dhtmlXCombo("c2", "c2", 150);
         node.combo1.attachChildCombo(node.combo2, "php/name.php?parent=$mask");
         node.combo3 = new dhtmlXCombo("c3", "c3", 50);
         node.combo2.attachChildCombo(node.combo3, "php/surname.php?parent=$mask");
         node.combo4 = new dhtmlXCombo("c4", "c4", 150);
         node.combo3.attachChildCombo(node.combo4, "php/types.php?parent=$mask");
         this._node_init = true;
         }
      },

      get_value:function(node,ev){
         var a = ev.category = node.combo1.getComboText();
         ev.name = node.combo2.getComboText();
         ev.surname = node.combo3.getComboText();
         ev.types = node.combo4.getComboText();
            return a;
      },

   }

[/code]
Lightbox section is:

{name:"category", height:21, type:"combo_select", map_to:"category"},

I have the appropriate fields in “render_table”.
This code work and save in my DB.

The problem is:
If I edit the event without refresh the page it’s Ok, but if refresh the page and edit the event I lost the values in combogroup fields of lightbox “category,name,surmane,types”.

Can you help me ?
Thank You

Sondra

Hi,

combo in groups mode doesn’t allow to set default values. In this case it would be better to use onChange event and reload combos manually:

parentCombo.attachEvent("onChange",function(){ /*selected value*/ var value = this.getActualValue(); ... /*reloading child combo*/ childCombo.clearAll(true); childCombo.loadXML(url+"?parent="+value,function(){ childCombo.setComboValue(defaultValue); }); })

For example, the default value for the combo2 is ev.name

Thank you Alexandra.
Where I must Insert your suggested code?
Sondra

Hi,

this code is just an sample. You may apply this approach to the necessary combos instead of attachChildCombo method.

For example instead of node.combo2 could be parentCombo when node.combo1 is childCombo