New event doesn't appear without refreshing.

I’ve created a custom details form for scheduler to gather event details. When I double-click a date my form opens and I can see the tentative event title displayed beneath on the scheduler component.

When I call save_form the event details are gathered and lightbox goes away.

[code]var html=function(id){ return document.getElementById(id); }; //just a helper

function save_form() {
var ev = scheduler.getEvent(scheduler.getState().lightbox_id);
ev.text = html(“eventDescription”).value;
ev.event_type = “”;
ev.start_date = html(“calendar”).value;
ev.end_date = html(“calendar2”).value;
scheduler.endLightbox(true, html(“customSchedulerDetails”));
}[/code]

So far, so good… but now the event text is not displayed on the scheduler control. I’m using data processor with scheduler and I can see that a new event is inserted in the database with the correct values. If I reload the screen my event will be on the correct date.

Is there a call I need to make to force scheduler to render my new event? It seems very odd that it’s tentatively on the control until I press the save button, then it disappears.

Hello,

ev.start_date = html("calendar").value; ev.end_date = html("calendar2").value;
start_date, end_date should be Date objects, not strings. Be sure to convert them (scheduler.date.str_to_date) may help.

Kind regards,
Ilya

Thank you kindly. That’s the tip I needed to get it working. The following modification fixed the problem.

[code]var convertStartDate = scheduler.date.str_to_date("%Y-%m-%d %H:%i");
var convertEndDate = scheduler.date.str_to_date("%Y-%m-%d %H:%i");

ev.start_date = convertStartDate(html(“calendar”).value);
ev.end_date = convertEndDate(html(“calendar2”).value);[/code]

Bill

On the same subject, is there any documentation on what sort of value the event is expecting for recurring events?

By reading the documentation at http://docs.dhtmlx.com/doku.php?id=dhtmlxscheduler:recurring_events#rec_type I’m pretty sure I can generate a valid rec_type string. Currently I’m using a test string that the default lightbox form generated.

When I try and save the test rec_type string from my custom lightbox form the end_date gets set to “undefined” and persisted to my database. (The length attribute is automatically populated along the way.)

[code]function save_form() {
var ev = scheduler.getEvent(scheduler.getState().lightbox_id);

    ev.text = html("eventDescription").value;

    // Create a date converter.
    var convertStartDate = scheduler.date.str_to_date("%Y-%m-%d %H:%i");
    var convertEndDate = scheduler.date.str_to_date("%Y-%m-%d %H:%i");

    // Convert the date from strings to Date objects.
    ev.start_date = convertStartDate(html("calendar").value);
    ev.end_date =   convertEndDate(html("calendar2").value);
 
    ev.rec_type = "day_1___#3";  // Test recurring string.
    
    // Second parameter is ID of custom detail form div tag.               
    scheduler.endLightbox(true, html("customSchedulerDetails"));       

}[/code]

What sort of types and/or data is the event expecting for recurring events? Will it calculate the correct end_date for the recurring event or is it expecting me to do that while saving the form data? Is there a dhtmlxscheduler_recurring_debug.js file available that would help explain the recurring event logic?

I appreciate your efforts,
Bill