CalendarXP.net Support Forum Index CalendarXP.net Support
Most forums here are private and invisible to public.
 
 FAQFAQ   SearchSearch   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Display alert message when a date is selected

 
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> FlatCalendarXP Related
View previous topic :: View next topic  
Author Message
billq23



Joined: 24 Aug 2007
Posts: 4

PostPosted: Fri Aug 24, 2007 7:01 pm    Post subject: Display alert message when a date is selected Reply with quote

I am using the multi picker calendar and I would like to display an alert message when a specific date range is selected. For example when some selects a day in the range Oct 1 - Oct 15 pop up a message that says "These days are not available".

Please let me know if this is possible.
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Fri Aug 24, 2007 10:22 pm    Post subject: Reply with quote

Yes, simply add the alert() call to the action parameter of your agenda. e.g.
Code:
fAddEvent(2007,10,1, "These days are not available", "alert('These days are not available')", "#87ceeb", "dodgerblue");
fAddEvent(2007,10,2, "These days are not available", "alert('These days are not available')", "#87ceeb", "dodgerblue");


But even better way of preventing user from selecting is to set the action to null. e.g.
Code:
fAddEvent(2007,10,1, "These days are not available", null, "#87ceeb", "dodgerblue");

_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Back to top
View user's profile Send private message
billq23



Joined: 24 Aug 2007
Posts: 4

PostPosted: Mon Aug 27, 2007 12:25 pm    Post subject: Reply with quote

If I use the first example, with the quotes around the alert() call, nothing happens when the date is selected. If I remove the quotes I get an alert, but only when the calendar loads. Then the date has a line through it and is unselectable.

What I'm trying to do is display a message about why the date is unavailable, but I would still like to it to be selectable.

I tried your suggestions on the demos and it worked fine on the fullsized demo, but not on the multipicker. I am trying to do this with the multiselect plugin, so I don't know if that could be my problem.
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Mon Aug 27, 2007 3:47 pm    Post subject: Reply with quote

We just found it's a bug in the multi-select plugin. We'll fix it in the next version, for now you may modify the fAddDate() function in your plugins.js to be as following:
Code:
function fAddDate(y,m,d) {
   var ag=fGetAgenda(y,m,d,false);
   if (fIsSelected(y,m,d)||ag[1]==null) return;
   if (gContainer.fAddListItem) gContainer.fAddListItem(fDateString(y,m,d));
   if (ag[1]) eval(ag[1]);
   if (fAfterSelected) fAfterSelected(y,m,d);   
}

Keep using the fAddEvent() code in the previous post.

_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Back to top
View user's profile Send private message
billq23



Joined: 24 Aug 2007
Posts: 4

PostPosted: Mon Aug 27, 2007 7:39 pm    Post subject: Reply with quote

I changed to use the new fAddDate function. When I select the date I do get the alert message, but it appears to stay in "mouse click down" mode, so it selects any other cells that are moused over.
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Mon Aug 27, 2007 7:49 pm    Post subject: Reply with quote

It's because the popup interrupts the drag-and-drop process - it's a known issue of IE, Firefox doesn't exhibits such problem.

In your case, please use the following code instead:
Code:
function fAddDate(y,m,d) {
   var ag=fGetAgenda(y,m,d,false);
   if (fIsSelected(y,m,d)||ag[1]==null) return;
   if (gContainer.fAddListItem) gContainer.fAddListItem(fDateString(y,m,d));
   if (ag[1].indexOf("alert")!=-1)
      __lastDrag=null;
   eval(ag[1]);
   if (fAfterSelected) fAfterSelected(y,m,d);
}

_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.


Last edited by calendarxp on Mon Aug 27, 2007 7:59 pm; edited 3 times in total
Back to top
View user's profile Send private message
billq23



Joined: 24 Aug 2007
Posts: 4

PostPosted: Mon Aug 27, 2007 7:52 pm    Post subject: Reply with quote

Works great.

Thanks for your help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> FlatCalendarXP Related All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Copyright 2003- Idemfactor Solutions, Inc. All rights reserved.
Powered by phpBB © 2001, 2005 phpBB Group