The code I gave before works if you only have one textarea on your form. If you have more than one textarea, you must first edit the dhtmlscheduler.js file.
Find this code:
scheduler.form_blocks={
textarea:{
render:function(sns){
var height=(sns.height||"130")+"px";
return "<div class='dhx_cal_ltext' style='height:"+height+";'><textarea></textarea></div>";
And replace it with this code to add an id to the div that holds the textarea:
scheduler.form_blocks={
textarea:{
render:function(sns){
var height=(sns.height||"130")+"px";
return "<div class='dhx_cal_ltext' id='sns.name' style='height:"+height+";'><textarea></textarea></div>";
And then, in your init() function add this code (pay special attention to the highlighted portion):
NOTE: You MUST handle each of your textarea fields in your custom set_value function.
scheduler.form_blocks.textarea.set_value=function(node,value,ev){
//////////////////////////////////////////////////////////////////////////////////////
var sns = scheduler.config.lightbox.sections;
for (var i=0; i < sns.length; i++) {
//DESCRIPTION - Field I am hiding
if(sns[i].name == "description"){
//editor area
var thisdescription = document.getElementById("description");
thisdescription.innerHTML = "<textarea readonly='readonly'>"+ev.itemtype+"</textarea>" || "<textarea readonly='readonly'>Task</textarea>";
thisdescription.style.display = "none";
//section header
var thisthisdescriptionheader = document.getElementById(sns[i].id);
thisthisdescriptionheader.style.display = "none";
//force auto-resize of lightbox
scheduler.setLightboxSize();
//////////////////////////////////////////////////////////////////////////////////////
//ITEMCATEGORY - readonly field, and display "better looking" text
}else if(sns[i].name == "itemcategory"){
//editor area
var thisitemcategory = document.getElementById("itemcategory");
if(ev.itemcategory == "nonspecialty"){
thisitemcategory.innerHTML = "<textarea readonly='readonly'>Non-Specialty</textarea>";
}else if(ev.itemcategory == "welding"){
thisitemcategory.innerHTML = "<textarea readonly='readonly'>Welding</textarea>";
}else if(ev.itemcategory == "electrical"){
thisitemcategory.innerHTML = "<textarea readonly='readonly'>Electrical</textarea>";
}else if(ev.itemcategory == ""){
thisitemcategory.innerHTML = "<textarea readonly='readonly'></textarea>";
}
thisitemcategory.style.display = "block";
//section header
var thisitemcategoryheader = document.getElementById(sns[i].id);
thisitemcategoryheader.style.display = "block";
//STDHOURS - not readonly
}else if(sns[i].name == "stdhours"){
//editor area
var thisstdhours = document.getElementById("stdhours");
thisstdhours.innerHTML = "<textarea>"+ev.stdhours+"</textarea>" || "<textarea></textarea>";
thisstdhours.style.display = "block";
//section header
var thisstdhoursheader = document.getElementById(sns[i].id);
thisstdhoursheader.style.display = "block";
//UNITSTYPE - readonly field
}else if(sns[i].name == "unitstype"){
//editor area
var thisunitstype = document.getElementById("unitstype");
thisunitstype.innerHTML = "<textarea readonly='readonly'>"+ev.unitstype+"</textarea>" || "<textarea readonly='readonly'></textarea>";
thisunitstype.style.display = "block";
//section header
var thisunitstypeheader = document.getElementById(sns[i].id);
thisunitstypeheader.style.display = "block";
//ITEMQTY - not readonly
}else if(sns[i].name == "itemqty"){
//editor area
var thisitemqty = document.getElementById("itemqty");
thisitemqty.innerHTML = "<textarea>"+ev.itemqty+"</textarea>" || "<textarea></textarea>";
thisitemqty.style.display = "block";
//section header
var thisitemqtyheader = document.getElementById(sns[i].id);
thisitemqtyheader.style.display = "block";
//ITEMTOTAL - readonly field
}else if(sns[i].name == "itemtotal"){
//editor area
var thisitemtotal = document.getElementById("itemtotal");
thisitemtotal.innerHTML = "<textarea readonly='readonly'>"+ev.itemtotal+"</textarea>" || "<textarea readonly='readonly'></textarea>";
thisitemtotal.style.display = "block";
//section header
var thisitemtotalheader = document.getElementById(sns[i].id);
thisitemtotalheader.style.display = "block";
}
}
}
Just FYI… my lisghtbox sections configuration looks like this:
scheduler.config.lightbox.sections=[
{name:"description", height:50, map_to:"itemtype", type:"textarea"},
{name:"itemname", height:21, type:"select", map_to:"itemname", options:[
<?php
$Ctasks = mysql_query("select * from tasks where belongsto != 'milestone' order by belongsto, taskname");
$counttasks = mysql_num_rows($Ctasks);
$task = 1;
while($Rtasks=mysql_fetch_array($Ctasks)){
if($task == $counttasks){
echo '{ key:"'.$Rtasks['taskname'].'", label:"'.$Rtasks['belongsto'].' - '.$Rtasks['taskname'].'" }';
}else{
echo '{ key:"'.$Rtasks['taskname'].'", label:"'.$Rtasks['belongsto'].' - '.$Rtasks['taskname'].'" },';
}
$task++;
}
?>
]},
{name:"itemcategory", height:25, map_to:"itemcategory", type:"textarea"},
{name:"stdhours", height:25, map_to:"stdhours", type:"textarea"},
{name:"unitstype", height:25, map_to:"unitstype", type:"textarea"},
{name:"itemqty", height:25, map_to:"itemqty", type:"textarea"},
{name:"itemtotal", height:25, map_to:"itemtotal", type:"textarea"},
{name:"time", height:72, type:"time", map_to:"auto"}
]