attachEvent Custom Form

Hi all.
I have a problem with my custom form.

scheduler.startLightbox(id, html("my_form") ); 

In standard scheduler I have this working code:

scheduler.attachEvent("onBeforeLightbox", function(id){ var ev = scheduler.getEvent(id); if (ev && ev.start_date < (new Date())) { alert("ERROR."); return false; } return true; })

But in my custom form don’t work.

Can you help me ?

Thank you.
Sondra

If you want

html(“my_form”)

to work, you have to have defined it earlier as it’s not a default function. Put this line somewhere before the init of the scheduler:

var html=function(id){ return document.getElementById(id); };

Next, you have to surround your custom form with a div tag with the id set as “my_form” for this call to work like so:

<div id="my_form">
//custom HTML code here
</div>

Also, at the very end of your code, you’re missing a semi-colon:

scheduler.attachEvent("onBeforeLightbox", function(id){
var ev = scheduler.getEvent(id);
if (ev && ev.start_date < (new Date())) {
alert("ERROR.");
return false;
}
return true;
}); //semi-colon added here

I hope this helps

Osu

If you are using the same approach as in
samples\02_customization\16_custom_form.html
custom code replaces original showLightbox method and onBeforeLightbox event will never be triggered.

Thank you.

My approach is samples\02_customization\16_custom_form.html

With custom form I loss all attachEvent functionality ?

Sondra.

Nope, only events related to the lightbox ( because now you are using custom form instead of lightbox )