Hello,
if you use details form that is defined via scheduler.config.lightbox.sections config, the more or less generic way to redraw it on the fly may look like following:[code]//store possible configurations somewhere
var configs = {
type1: [
{name:“description”, height:43, map_to:“text”, type:“textarea” , focus:true},
{name:“subject”, height:20, type:“select”, options: subject, map_to:“subject” },
{name:“time”, height:72, type:“time”, map_to:“auto” }
],
type2: [
{name:“description”, height:43, map_to:“text”, type:“textarea” , focus:true},
{name:“time”, height:72, type:“time”, map_to:“auto” }
]
};
//function to switch lightbox configuration and redraw the form
function switchLightbox(type){
if(configs[type]){
var box_visible = scheduler.getState().lightbox_id;
if(box_visible){
scheduler.hide_lightbox();
}
scheduler.config.lightbox.sections = configs[type];
scheduler.resetLightbox();
if(box_visible){
scheduler.showLightbox(box_visible);
}
}
};[/code]
Then it can be called as switchLightbox(‘type1’);
If you need to preserve selected values, you can collect them from the form via scheduler.formSection(section).getValue method, and assign to the new form via .setValuescheduler.formSection(controlName).getValue();
//and
scheduler.formSection(controlName).setValue();
docs.dhtmlx.com/scheduler/api__s … ction.html
However, the ‘time’ and the ‘recurrence’ controls might need some custom approach.
If you define custom html form, the approach may be similar except for the ‘.formSection’ part.
You must have been implemented a way to assign event values to the form when it’s opened, and the way retreive values from the form when it’s saved. So, before closing lightbox of one type, you can collect the values, and apply them after new lightbox is opened