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 

Progressive date field

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



Joined: 11 Jul 2008
Posts: 2

PostPosted: Sat Jul 12, 2008 1:04 am    Post subject: Progressive date field Reply with quote

I have to add to calendarXP the ability to click the calendar icon to select a date and place the date into an input field as
01-JAN-2008. When i click the calendar icon again and select a second date. I need to place the new date into the text field as 01-JAN-2008, 10-JAN-2008. How do I do this? Thanks
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Sat Jul 12, 2008 3:31 am    Post subject: Reply with quote

Just modify the fAfterSelected function in your plugins.js to be as the following scripts:
(Note that you do need to add the line before the function.)
Code:
var _progDates=null;
function fAfterSelected(y,m,d,e) {
   
   if (_progDates)
      _progDates += ", " + gdCtrl.value;
   else
      _progDates = gdCtrl.value;
   
   gdCtrl.value = _progDates;
}

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



Joined: 11 Jul 2008
Posts: 2

PostPosted: Mon Jul 14, 2008 7:27 pm    Post subject: I forgot to add Reply with quote

The method you gave me works great.

But I forgot to add the fact that I want to have the ability to use the DATE1, DATE2 on some calendar pop up fields but not on others. Is there a way to add a boolean to this call that I could pass a true or false to turn of this ability or keep it off?

Thanks.
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Mon Jul 14, 2008 10:30 pm    Post subject: Reply with quote

In that case you just need to set a marker "progressive" to the class property of your input field, e.g.
Code:
<input name="prDate" class="progressive">

if your input field already has a CSS class value assigned, then just append the word "progressive" with a space, e.g.
Code:
<input name="prDate" class="css1 progressive">

finally, use the following code in plugins.js:
Code:
function fOnChange(y,m,d,e) {
   // store the value of the current date picker
   _progDates=gdCtrl.value;   
}

function fAfterSelected(y,m,d,e) {
   // check if the field needs progressive dates
   if (!(/progressive/i.test(gdCtrl.className))) return;

   if (_progDates)
      _progDates += ", " + gdCtrl.value;
   else
      _progDates = gdCtrl.value;
   
   gdCtrl.value = _progDates;
}

This should work with multiple fields in same page.

_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
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 -> PopCalendarXP 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