Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by mahesh on Dec 08, 2009 17:03
open dhtmlx forum
dhtmlx scheduler, lightbox select entry, and default value

I am using lightbox with several custom fields:
As an example.

var sections1=[
            {key:1, label:"Unassigned"},
            {key:2, label:"Room A"},
            {key:3, label:"Room B"},
            {key:4, label:"Meeting"}

Is there a way to make key 1 be the default value rather than forcing the user to pick?
        ];
Answer posted by Alex (support) on Dec 09, 2009 02:17

You can redefine the set_value method (http://dhtmlx.com/dhxdocs/doku.php?id=dhtmlxscheduler:custom_details_form):

scheduler.form_blocks.select.set_value = function(node,value,ev){

  node.firstChild.value=value||1;
}

Answer posted by mahesh on Dec 10, 2009 19:26

Still a bit confusing:

I have lightbox configured as:

scheduler.config.lightbox.sections=[

 
                        {name:"prolength", height:23, type:"my_select", options:procedure, map_to:"section2_id" },
  {name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
                        {name:"custom", height:23, type:"select", options:sections, map_to:"section_id" },
                        {name:"loc", height:23, type:"my_select", options:sections1, map_to:"section_id1" },           
  {name:"time", height:72, type:"time", map_to:"auto"}

What I want to do is set  custom and loc to the first entry in the list?
Answer posted by mahesh on Dec 10, 2009 21:57

I tried:

scheduler.form_blocks.select.set_value=function(node,value,ev){ node.firstChild.value = 1;}

which works,

but then in the units view (I have 2) wherein I use the type:select for both, when I create an event under that unit it also picks up the value 1 rather than the unit view it was created in.  I only want the value 1 when the event is created in the non-unit view for that unit, i.e. week, month, or day view.

Is there a solution to this?

 

Answer posted by Alex(support) on Dec 11, 2009 00:25

The soluution provided in the previous answer (http://dhtmlx.com/docs/products/kb/index.php?s=normal&q=13358&a=21705) was:

scheduler.form_blocks.select.set_value = function(node,value,ev){
    node.firstChild.value = value||1;
}

Try to use it.



Answer posted by mahesh on Dec 11, 2009 08:51

Alex,

   Awesome, works like a charm!   I think I found the other line of code on a prior knowledge post rather than using your suggested version.  My sincere apologies, and to you group as a whole thanks for ansering my unending stream of questions.

   -Mahesh