custom lightbox section hidden if its value =0

Hi,

I have created a custom lightbox and need to show fields if only they previously have data in database, if the data in the database is equal to zero the specific field should not display on lightbox.

Any help? thanx in advance.

Hi,
you can set “style.display=‘none’” for your section if this event property contain false value:
docs.dhtmlx.com/scheduler/lightb … someevents

scheduler.config.lightbox.sections=[

		{name:"time", height:72, type:"time", map_to:"auto"},
		{name:"reccuring", height:21, type:"select", map_to:"rec_type", options:recur},
		{name:"custom", height:30, type:"timeline", options:null , map_to:"section_id" }, 
		{name:"special0", height:30, map_to:"reminder_x", type:"textarea"},
		{name:"special", height:30, map_to:"reminder_time", type:"select", options:reminder_timex},
		{name:"title", width:50, height:30, map_to:"text", type:"textarea" },
		{name:"custom2", width:20, height:30,  type:"textarea", map_to:"location" },
		{name:"custom3", width:20, height:80,  type:"textarea", map_to:"details" },

		{name:"custom4", height:30, map_to:"status", type:"select", options:status_opt},
		{name:"custom5", height:30, map_to:"landlord_name", type:"textarea"},
		{name:"custom6", height:30, map_to:"lref_no", type:"textarea"},
		{name:"custom7", height:30, map_to:"agent", type:"select", options:agent_opt},
	
	]

I want to hide custom4, custom5, custom6 and custom 7 if they dont have values. cant figure out using the hidden function mentioned above

Hi,
you can access DOM elements of the sections using scheduler.formSection and change their visibility,
code might look like following:

[code]scheduler.attachEvent(“onLightbox”, function(id){
var ev = scheduler.getEvent(id);

var sections = scheduler.config.lightbox.sections;

var display = {
	"custom4":true, 
	"custom5":true, 
	"custom6":true, 
	"custom7":true
};

for(var i =0; i < sections.length; i++){
	var section = sections[i];
	if(!display[section.name]){
		continue;
	}

	var element = scheduler.formSection(section.name).node;

	if(!ev[section.map_to]){
		//if empty value - hide
		element.style.display = "none";
	}else{
		//otherwise - show
		element.style.display = "";
	}

}

});[/code]

docs.dhtmlx.com/scheduler/api__s … ction.html
docs.dhtmlx.com/scheduler/api__s … event.html