Duplicate event on EventAdded

Hi,
i write this code

[code]
scheduler.attachEvent(“onEventAdded”, function(event_id,event_object){
var ev = scheduler.getEvent(event_id);
if (ev.duplica==1)
var risp = confirm(“Duplica evento?”);
if (risp) {

				    scheduler.addEventNow({
						  start_date: ev.start_date,
						  end_date: ev.end_date,
						  text:"Some",
						  custom_data:"some data"
				   });
			
			}
			else alert("no");
     });[/code]

i want to clone event…
The addEventNow work but don’t show lightbox form to modify and confirm information…
Anybody can help me?!

thanks
Fra

addEventNow may be called in moment when old lightbox is not closed yet, which will result in above behavior.

Just isolate your code with setTimeout

scheduler.attachEvent("onEventAdded", function(event_id,event_object){
         var ev = scheduler.getEvent(event_id);
         if (ev.duplica==1)
            var risp = confirm("Duplica evento?");
            if (risp) {
               window.setTimeout(function(){
                   scheduler.addEventNow({
                       start_date: ev.start_date,
                       end_date: ev.end_date,
                       text:"Some",
                       custom_data:"some data"
                  });
               },1);

Thank’s, it’s perfect!!!
:slight_smile:
Fra