Amit has noted on a prior post:
There are two definitions of the set_value method of my_select object:
scheduler.form_blocks.my_select = {
get_value : select.get_value,
set_value : function(node,value,ev){
…
and
scheduler.form_blocks.my_select.set_value = function(node,value,ev){
Try to use one.
<------------------------------------>
There should be a way to combine the javasciript functions, so I can fill both the lightbox text and set the times on a single onchange event. I am trying to work on this, but not succeeeding very well.
Thanks for your help so far. Here is my lightbox confguration:
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:“time”, height:72, type:“time”, map_to:“auto”}
]
Here is the function code:
var select = scheduler.form_blocks.select;
scheduler.form_blocks.my_select = {
get_value : select.get_value,
set_value : function(node,value,ev){
mode = node.firstChild;
mode.value=value||"";
mode.onchange=set_end_time;
},
render : select.render,
focus : select.focus
}
})()
//Add in selected procedure text into description field
scheduler.form_blocks.my_select.set_value = function(node,value,ev){
var txta = document.getElementsByTagName(“textarea”)[0];
var selectEl = node.firstChild;
selectEl.onchange = function(){
var index = selectEl.selectedIndex;
txta.value = selectEl.options[index].text;
}
node.firstChild.value=value||"";
}
Each will work independantly, but not together.
-Mahesh
Only the latest second set_value definition will be applied (you have defined set_value method twice).
You should use only one method. For example:
scheduler.form_blocks.my_select = {
get_value : select.get_value,
set_value : function(node,value,ev){
mode = node.firstChild;
mode.value=value||"";
var txta = document.getElementsByTagName(“textarea”)[0];
var selectEl = node.firstChild;
selectEl.onchange = function(e){
set_end_time(e)
var index = selectEl.selectedIndex;
txta.value = selectEl.options[index].text;
}
},
render : select.render,
focus : select.focus
}
Thanks-it works!!