Dynamic lightbox sections

Is it possible to dynamically build the lightbox based on rules? For example, if variable “recurring_allowed” is true then we will include the recurring part of the lightbox. I could also include other optional sections based on the user’s privileges.

Yes, it’s possible to reconfigure ligthbox with resetLightbox method, you can do it every time when lightbox shows up. Something like following:

[code]scheduler.attachEvent(“onBeforeLightbox”, function (event_id){
var config;
config = [
{name:“description”, height:200, map_to:“text”, type:“textarea” , focus:true},
{name:“time”, height:72, type:“time”, map_to:“auto”}
config = [
{name:“time”, height:72, type:“time”, map_to:“auto”}

scheduler.config.lightbox.sections = config;
return true;

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

Thanks for prompt response Aliksandr.
I’m still not sure how to “build” the config variable though. There could potentially be lots of different versions of the lightbox, depending on several conditions. I need to be able to “append” sections to the lightbox configuration after checking each condition.
Is that possible, or do I need to define all the different possible lightboxes?

Sure, lightbox configuration is a regular js array with lightbox controls. You can append these controls conditionally and then assign resulting array to lightbox config.
Something like following:[code]var lb = [];//initial config

if(canEdit)//add text editor
lb.push({name:“description”, height:200, map_to:“text”, type:“textarea” , focus:true});

if(canSetTime)//add time picker
lb.push({name:“time”, height:72, type:“time”, map_to:“auto”});

//apply config
scheduler.config.lightbox.sections = config;

Perfect! That’s exactly what I need. Thanks so much. :smiley: