PDA

View Full Version : Popup Calendar - HELP Sev Kotchnev



coverland
10-25-2007, 02:30 AM
1) Script Title: Popup Calendar

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex6/popcalendar.htm#

3) Describe problem: You wrote in your help file:
Part of your readme file follows:

Introduction:

PopUp Calendar has been designed as a part of our data software (DataShell Software). It provides a user friendly and flexible way to choose dates and insert them in form fields. You need only one instance of PopUp Calendar on your page to attach it to an unlimited amount of form fields.
As this calendar has been made first as an interactive date selector for online orders, it differs of decorative calendars: it displays only 13 months starting the current one and including the same month of the next year. This range is enough for dates of orders/enrollments (unless you collect orders for 2 years in advance or from the past :-)
To see if it can be of any use for you please check any form field below. Have a nice one!
-----------------------
My big question Sir... You wrote in your help file that this calendar "displays only 13 months starting the current one". So if you needed it to go back further then the current displayed month, what would you re-code to make that happen? Would it be difficult to let it go back as far as it will go forward? In other words, now that it's October of 2007, how would you have it read August or September of 2007 and be able to select a date from the past?

Thank you for any help.

cov

Strangeplant
10-25-2007, 02:10 PM
I started to use this once, a long time ago and did my task another way.

This is very old code, and really MUST be updated to be compatible with FF. It uses document.all and document.layers which dates back to Netscape 4.

but to answer your question, change the .js file: It defines its 13 month interval (blue) and starting place (red) within that range in the following function:


function setSelectList(year,month) {
var i = 0;
var obj = null;
if (ppcIE) {obj = document.ppcMonthList.sItem;}
else if (ppcNN) {obj = document.layers['PopUpCalendar'].document.layers['monthSelector'].document.ppcMonthList.sItem;}
else {/* NOP */}
while (i < 13) {
obj.options[i].value = year + "|" + month;
obj.options[i].text = year + " " + ppcMN[month];
i++;
month++;
if (month == 12) {year++;month = 0;}}}

So, to start at the second month in the range, change
var i = 0;to
var i = 1;

To make that starting point the same as the current month, you would have to change year,month to the previous month (of course taking into account the possible change of the year too.)

But I would never use a script that doesn't work in FF, so that has to be fixed first.

coverland
11-08-2007, 03:01 PM
Tried the suggestion and it changes the behavior but still doesn't do it. Before for example, the proper month would show in the window with the proper days for that respective month. When I change the 0 to a 1, the proper days for November showed up but the month showed January so the title for the calendar no longer matched the selectable days displayed.

Info on this calendar is:
/* PopUp Calendar v2.1
PCI, Inc.,2000 Freeware
Permission granted for unlimited use so far
as the copyright notice above remains intact. */

It works excellent OTHER than not being able to click a date in any prior month. If only Sev had included that, it would be near flawless. Is there other example pop-ups anyone is familiar with? I like this one very well but need to be able to click back prior to the current month just as it allows you to click forward. TIA