addEventNow stops my onEventChanged event

Hello to all!
I have a problem. When I execute scheduler.addEventNow and save the event, when i drag it somewhere else the onEventChanged event is not called. Can you help me please on how I can fix it?
Thank you very much!

scheduler.showLightbox = function(id) {
               evopen = scheduler.getEvent(id);
               var lurl = null;
               if (id > 1000000) {
                    lurl = '<?php echo Yii::app()->baseUrl; ?>/tasks/create';
               } else {
                    lurl = '<?php echo Yii::app()->baseUrl; ?>/tasks/update/id/' + id;
               id > 1000000 ? scheduler.deleteEvent(id) : true;
               openLightbox('dialog', lurl,  evopen.text, 950);

function openLightbox(div_id, theurl, thetitle, thewidth) {
	var winh = parseInt($(;$('#' + div_id + ' iframe').attr('src', theurl).css({
		'height' : (winh - 80) + 'px',
		'width' : (thewidth || '965') + 'px',
		'border' : 'none'

	setTimeout(function() {$('#' + div_id).dialog({
			autoOpen : true,
			title : thetitle,
			modal : true,
			width : thewidth ? (thewidth + 35) : 1000,
			height : (winh - 30) + (($.browser.msie) ? "px" : ""), 
			position : 'top',
			close : function() {

	}, 10);$('#' + div_id + ' iframe').fadeIn('fast');

function closeLightbox(div_id, message) {$('#' + div_id).dialog('destroy');

	var notification = $('div.notification').addClass('success').html(message);
				'left' : parseInt(($(document).width() / 2)
						- ($('.notification').width() / 2))
						+ 'px'
		'top' : '0px'
		'top' : '-50px'
	div_load_data('clients_frame', '/clients/admin');
	div_load_data('cases_frame', '/cases/viewAll');
id > 1000000 ? scheduler.deleteEvent(id) : true;

The above line in your code deletes the event just after creating
Why do you need the above line ?

Because I want to delete the auto generated event. After save i get all the events again.

Is there any better way to do that? I commented it but it didn’t solve my problem.

Is there any better way to do that? I commented it but it didn’t solve my problem.
Deleting event in that moment ( after creating, but before saving fully finished ) can cause hardly predictable effects.

You can use onBeforeEventChanged and return false, for events which you do not want to be created.

I did it but when i click on the scheduler to create an event the popup form is now showing… what else should i do please? Thank you.

When false is returned from onBeforeEventChanged event - new event will not be create and lightbox will not be shown.

To block the lightbox only you can return false from onBeforeLightbox ( but do not delete event here - you can use above handler to block the creation of new events )

I want to block the event creation on the calendar ui, but to show the lightbox with the selected dates! :slight_smile: Is there any way to achieve that without that small hack?
Thank you

The lightbox must be linked to some event object.
Instead of deleting event just after creation you may delete it after lightbox closing, which will be more safe approach.

Any resolution to this issue? I am seeing the same issue. I am loading a custom form using onBeforeLightbox. Once onBeforeLightbox is called, onEventChanged will not fire when subsequent events are dragged.

	scheduler.attachEvent("onBeforeLightbox", function (event_id){"%Y-%m-%d %H:%i:%s");
		var ev2 = scheduler.getEvent(event_id);
	      	var date2 = new Date(); 
	      	var timestamp = date2.getTime();
	      	var starttime = encodeURI(scheduler.templates.tooltip_date_format(ev2.start_date));

			if(scheduler._mode =='unit'){
				var instid=ev2.section_id;
				var instid=<?=$_SESSION ['instid']?>;
			var show_start=0;
			if(scheduler._mode=="month" || scheduler._mode=="week_agenda"){
				var show_start=1;
		       $( "#dialog-form" )
			.load('inst_schedule_new.php?temp_event_id='+event_id+'&show_start='+show_start+'&instid='+instid+'&date='+starttime+'&cdate='+ timestamp).dialog('option', 'title', 'Book / Block Time')
		       .dialog( "open" );

After closing your custom edit form you need to call


which will correctly clear all inner flags, and all processing after that point will goes correctly.