Lightbox Show and Hide Section when Adding Event

I am loading events from two separate DB tables and saving them with a conditional call to toggle the connector, which works fine.

When adding an event, I would like to show/hide a lightbox section when an option is selected on the form (since some data is not required for that type of event).

The condition is shown here:

{ name:"category", height:30, map_to:"category", type:"select", options:[ {key:"1", label:"This"}, {key:"2", label:"That"}, {key:"3", label:"Other"}, {key:"0", label:"Unassigned"} ]},
Based on the option selected, I would like to hide/show the (separate) custom form block.
Is there a method in the API or an event I can add to achieve this?
Thanks.

There is no event for change of selection in “select” block, so you will need to create a custom form block, based on default “select” to catch the necessary moment.

Section can be hidden in the next way

docs.dhtmlx.com/doku.php?id=dhtm … ome_events

Thank you, yes, I have created a custom form block, and all works fine for events that have already been added. I would like to be able to control whether the custom block appears when ADDING an event, based on the selection of an option on the form (not part of the custom block - listed in previous entry on this topic).
Here is my custom block:

scheduler.form_blocks["Spot_Details"]={ render:function(sns){ var html="<div class='dhx_cal_ltext' style='height:108px;'>"; html+="Spot Preview:&nbsp;<input type='text' size='60'><br/>"; html+="ISCI Code:&nbsp;<input type='text'><br/>"; html+="Run Time:&nbsp;<input type='text'><br/>"; html+="Post Status:&nbsp;&nbsp;<select>"; html+="<option value='-1'>Planned"; html+="<option value='0'>New</option>"; html+="<option value='1'>Revisions Needed</option>"; html+="<option value='2'>Revised</option>"; html+="<option value='3'>Creative Approved</option>"; html+="<option value='4'>Awaiting Compliance</option>"; html+="<option value='5'>Compliance Approved</option>"; html+="<option value='6'>Completed</option>"; html+="<option value='7'>Hold</option>"; html+="</select></div>"; return html; },
Thanks for your help.

As noted, your example works fine when showing the Lightbox form when an event exists, but I still do not see how to toggle the custom form block when the event is created.

It seems I should be able to catch this condition with ‘onEventCreated’ or ‘onBeforeLightbox Event’

by adding something similar to:

	var style = (ev.category > 10)  ? "" : "none";
    		node.style.display=style; // editor area

But how to get a handle on the node style here?

In config

scheduler.config.lightbox.sections = [ {name:"description", height:200, map_to:"text", type:"textarea" , focus:true}, {name:"master", height:30, map_to:"a1", type:"master_select", options:[

master_select - name of custom form section, which has onchange handler

scheduler.form_blocks.master_select={ render:function(sns){ var height=(sns.height||"23")+"px"; var html="<div class='dhx_cal_ltext' style='height:"+height+";'><select style='width:552px;' onchange='filter_lightbox(this.value)'>";

and the same handler in set_value

set_value:function(node,value,ev){ if (typeof value == "undefined") value = (node.firstChild.options[0]||{}).value; filter_lightbox(value);

Handler may look as

[code]function filter_lightbox(value) {
if (value == 1)
hide_section(3,2);
else
hide_section(2,3);
}
function hide_section(hide, show){
hide = document.getElementById(scheduler.config.lightbox.sections[hide].id);
show = document.getElementById(scheduler.config.lightbox.sections[show].id);

	hide.style.display="none";
	hide.nextSibling.style.display="none";
	
	show.style.display="block";
	show.nextSibling.style.display="block";
	
	scheduler.setLightboxSize();
};	[/code]