View previous topic :: View next topic |
Author |
Message |
Atherton
Joined: 11 Jul 2008 Posts: 2
|
Posted: Sat Jul 12, 2008 1:04 am Post subject: Progressive date field |
|
|
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 |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Sat Jul 12, 2008 3:31 am Post subject: |
|
|
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 |
|
|
Atherton
Joined: 11 Jul 2008 Posts: 2
|
Posted: Mon Jul 14, 2008 7:27 pm Post subject: I forgot to add |
|
|
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 |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Mon Jul 14, 2008 10:30 pm Post subject: |
|
|
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 |
|
|
|