|
CalendarXP.net Support Most forums here are private and invisible to public.
|
View previous topic :: View next topic |
Author |
Message |
billq23
Joined: 24 Aug 2007 Posts: 4
|
Posted: Fri Aug 24, 2007 7:01 pm Post subject: Display alert message when a date is selected |
|
|
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 |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Fri Aug 24, 2007 10:22 pm Post subject: |
|
|
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 |
|
|
billq23
Joined: 24 Aug 2007 Posts: 4
|
Posted: Mon Aug 27, 2007 12:25 pm Post subject: |
|
|
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 |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Mon Aug 27, 2007 3:47 pm Post subject: |
|
|
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 |
|
|
billq23
Joined: 24 Aug 2007 Posts: 4
|
Posted: Mon Aug 27, 2007 7:39 pm Post subject: |
|
|
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 |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Mon Aug 27, 2007 7:49 pm Post subject: |
|
|
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 |
|
|
billq23
Joined: 24 Aug 2007 Posts: 4
|
Posted: Mon Aug 27, 2007 7:52 pm Post subject: |
|
|
Works great.
Thanks for your help.
|
|
Back to top |
|
|
|
|
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
|