OnBeforeLightBox

hi Stanislav,
here is what i would like to have.Each day a schedule may have upto a MAX of 1 schedule which overrides it.This override schedule is shown in red color.We want to prevent the user from adding another overriding schedule on top of it for each day or for that event.In other words when he double clicks it should not open the lightbox but ONLY display a message and when he double clicks on a date if there is no overriding schedule it should show the lightbox.Is this possible if so how ? Do we need to need to put that in “OnBeforeLightbox” event if not please advise? I know when you click on a date where there is no event the scheduler is not talking to the database but we need the capablilty to show either a message or the lightbox depending upon whether there is overriding schedule or not?How do we achieve this ? what methods in the backend do we have to handle this? Please let me know
Thanks

You can attach event handler to onBeforeEventChanged

  • check from it is it a new event ( third parameter )
  • get all events ( scheduler.getEvents ) for the date range of new event and if any exists - return false to block new event creation.

If by “overriding schedule” you mean not existing event, but some kind of db check it possible to make sync. ajax call from onBeforeEventChanged and based on its result return true or false ( allow or deny new event creation )

Thanks Stanislav,
Making a ajax call from javascript will have to wait for a response at least for a sec and if it doesnt get a response it will throw a error in the browser .How do we overcome that ? please advise

It is depends on solution, which you are using to make ajax calls.

Thanks Stanislav,
Here is the code my custom form looks like this

scheduler.form_blocks[“my_editor”]={

	render:function(sns){

		var xhtml=showHint('<%=userName%>');

		// After getting the response from the Ajax call i construct the DIV as shown below.But ajax call waits for a server response i cannot
		// construct the div without the response.Also the stateChanged method does not return the response.Once the response is returned i can 
		//construct the DIV and show it on the lightbox .But no luck

// i get a error message in browser saying the data required for this operation is not yet complete .

		//Please let me know or suggestive alternatives to achieve this functionality
			




		var divMediaStype="";
		divMediaStype="display:'';visibility:visible";
		
		
		 return "<div  id='my_custom_form' style='height:60px;'><div id='mediadiv' style='"+divMediaStype+"' >Monday&nbsp;"+xhtml+"</div><div id='tuediv' style='"+divMediaStype+"' ></br>Tuesday&nbsp;"+xhtml+"</div>

";

	},
	set_value:function(node,value,ev){

},
get_value:function(node,ev){

},
focus:function(node){

}
}

function showHint(user)
{

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url="EditBellAjax.jsp";

xmlHttp.open("GET",url,true);
xmlHttp.send(null);
xmlHttp.onreadystatechange=stateChanged;

}

function stateChanged()
{
// This method cannot return a response after the processing is complete how do i achieve this ?

var result;
if (xmlHttp.readyState==4)
{
 result= xmlHttp.responseText;
 
 return result;	

 
}

}