Two lightbox layout for one scheduler

[code] scheduler.attachEvent(“onBeforeLightbox”, function (event_id){
var ev = scheduler.getEvent(event_id);
if(ev != null && typeof ev != ‘undefined’ && ev.isIntervento ==“true” )
{
scheduler.config.lightbox.sections=[ {name:“Conferma Assegnazione”, height:48, map_to:“conferma_assegnazione”, type:“checkbox”,unchecked_value: “not_registered”},
{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”}
];
}
else
{

             scheduler.config.lightbox.sections=[   {name:"Tipo Evento", height: 48, options:presenza_assenza, map_to:"tipo_impegno", type:"radio", vertical: false },
                                                  {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"}
                                            ];   
             }
          return true;
          
      });[/code]

Hi, i want to have 2 different lightbox based on ev type and i use this code, but i have a lot of issue: 1) if i open type 1 event and then type 2 event lightbox doesn’t change
2) when i create type 1 ev and then i open type 2 i have a javascript exception after pressing each button (save,cancel,delet) (stop_event is the root of exception)

TypeError: document.getElementById(e[f].id) is null dhtmlxscheduler.js Line 177

TypeError: a is undefined dhtmlxscheduler.js Line 154

Can you help me?
Thank you.

scheduler.showLightbox = function(id){ var ev = scheduler.getEvent(id); if(ev != null && typeof ev != 'undefined' && ev.isIntervento =="true") { // WHAT HERE???? } else { scheduler.showOriginalLightbox(id); } };

Ok i found what i have to do but can you tell me how i can define my custom lightbox? json? html? xml?

thank you :slight_smile:

Hello,

Please check following sample:
scheduler/samples/02_customization/16_custom_form.html

Best regards,
Ilya

Hi,
i have checked this sample but i dont want to create a new form, i have to add, depending on event type, a check box or a radio button on the top of the lightbox and then leave the default layout (description time and unit list).
Is it possibile without create a new form?

Ok, then your initial approach was correct:

  • before lightbox is displayed we need based on your logic decide what set of sections should be displayed
  • edit scheduler.config.lightbox.section (assign new configuration)
  • call scheduler.resetLightbox()
  • return true

Kind regards,
Ilya

thank you it works :slight_smile: