Lightbox date fields incorrect after setEventEndDate

I’m changing end_date in the lightbox when a user selects a certain option from a dropdown menu.
(Not the dates dropdown, this is a custom dropdown I put in).

scheduler.setEventEndDate(event_id, my_end_date);

When the dropdown changes the date and setEventDate is called, the scheduler display updates but the date fields in the lightbox stay the same. How do I get the select options to change to reflect the new end date?

Hello,

Try following:

var sections = scheduler.config.lightbox.section; var time_section = sections[sections.length-1]; // if time is the last section var node = document.getElementById(time_section.id).nextSibling; var block = scheduler.form_blocks[time_section.type]; block.set_value.call(this, node, event[time_section.map_to], event, time_section); // note that event - is event object variable
It should update both start and end dates.

Best regards,
Ilya

Where would this code go? When I place it in onLightbox event I get javascript errors.

Hello,

I made a mistype in my previous code, here’s sample:

[code] scheduler.attachEvent(“onLightbox”, function(event_id){
var ev = scheduler.getEvent(event_id); // got event object

        // creating new dummy end date
        var nend = new Date(ev.end_date);
        nend.setHours(nend.getHours() + 3);

        scheduler.setEventEndDate(event_id, nend); // changing event end_time to it

        // updating lightbox section
        var sections = scheduler.config.lightbox.sections;
        var time_section = sections[sections.length - 1]; // if time is the last section
        var node = document.getElementById(time_section.id).nextSibling;
        var block = scheduler.form_blocks[time_section.type];
        block.set_value.call(this, node, ev[time_section.map_to], ev, time_section); // note that event - is event object variable
    });[/code]

Best regards,
Ilya

Tried and tried but I can’t get this code to work at all. I managed to inject my own javascript code into the scheduler to hack out a solution.

Hello,

Full sample I have used:

[code]

html, body{ margin:0px; padding:0px; height:100%; overflow:hidden; cursor: url("./mycursor.gif"), auto !important; }
 
 
[/code] It may fail in your case if time section is not the last, you need to modify code.

Best regards,
Ilya