|
| |||||
|
Here are all kinds of tips and tricks that will help you greatly in mastering and enjoying PopCalendarXP. How to add a PopCalendar to my web page?Simply append the calendar engine tag to the bottom of your webpage and call
Please check out the HelloWorld Tutorial for more details. How to use the themes?Create an empty directory, put the engine files in. Then go inside the themes
directory and pick up a theme you like, copy all files of the theme to the
directory just created. Finally, if you want to add agendas, you may start
with the It's quite straightforward, please check out the Tutorials for more details and samples. How to upgrade from the old version?If you are upgrading from within the same major version, e.g. from 6.0 to 6.1, all you need is to copy the new engine files to overwrite the old ones. That's all, there is no need to change your production page or any theme options. It's quite easy and painless. If you want to upgrade across major versions, e.g. from 5.2 to 6.0, then in addition to replacing the engine files you may also need to migrate the old theme options to the new theme if you want to keep your old theme working. Most of the time you don't need to change anything in your web page unless it is explicitly required by the new version in its release notes. How to localize the calendar so that it shows in languages other than english?PopCalendarXP comes with great themes optimized for English environment. But it's quite simple to localize them since all text strings are stored externally in either the theme files or the agenda file. All you need is to open them with a text editor like notepad and replace the English strings with your own language strings, then modify the css file to use corresponding font families. If your page was generated dynamically by ASP server and you saw rectangles
instead of normal fonts in Netscape 4.x, please set the http charset header
to "" by using If your page aims to support multiple languages(i18n), please follow the instructions in the i18n tutorials to create a simple i18n framework. How to setup the date format to be like "yyyymmdd"?Simply set the following options in the theme-name.js file. Note: When gsSplit is set to empty string, like above, settings of gbPadZero and giMonthMode will be ignored and the engine will render the format as if gbPadZero were set to true and giMonthMode to 0.
How can I retrieve daily agendas from the backend database?Depending on the cgi service you are using the solution might be a little different. The basic idea is to make your cgi service produce the agenda.js dynamically, e.g. from a JSP or ASP. We had it detailed in the "Setting up agendas & holidays" tutorial. How to change colors, fonts and other options?There are 2 files involved in a theme that control the look of the calendar
- The following example changes the background color of all the calendar cells to red (except Sundays) and the whole calendar to blue:
How to align the date number within the calendar cell?Go to the .CalCell {...; text-align:center; display:table;}How to perform a specific action when a date is clicked?For example, you want to perform the alert() function.
Note you may also use pre-defined
Or even startup your email client by using "mailto". e.g.
The calendar pops up a bit upper and lefter in a certain browser, how to correct it?It's a known issue for IE on Mac and Konqueror. To workaround, you may set the margin and padding of the <body> tag in your page to 0. e.g.
Another way is to take advantage of the
It means the calendar engine will offset the popup position 12 pixels righter and 14 pixels lower if it's running inside IE on Mac or Konqueror. How can I offset the PopCalendarXP relative to its current position?There is an option in the theme-name.js file called
Since version 8.2 you can also pass the offset data directly into the How can I pop-up the calendar at a static position in the page?There is an option in the theme-name.js file called How can I change the style of the outside calendar border?Simply change the Note: NN4 doesn't support outside border, it can only have the table
border set by The calendar doesn't show up in full or too large at first, but recovers after month switching. What's wrong?The calendar panel size is set initially by the Try increasing After configuring the theme, why all the calendar cells appear empty in Netscape 4.x?Make sure the Not all my agenda properties are working, why?Please check the How to set the initial month?There are 3 factors that determine which month will be shown when the calendar pops up for the very first time. 1st, if the associated form date object's value is a valid date, then that date will be selected and shown up. 2nd, otherwise if the 3rd, if none of the above applies, the calendar will show up with the month
set by the In the 3rd situation, for example, if you set the name&id of the calendar
tag to After the first pop-up, the calendar will remember the selected date. How to disable days, like weekends?Quite simple, all you need is to put 2 lines of code to the top of fHoliday() function in agenda.js file so that it looks like:
It creates a "null" agenda template, I have many duplicate events occuring regularly, must I generate an agenda for each of them?No, you don't need. Duplicate events can be treated as holidays. Instead
of repeating the How can I access the DOM objects of the webpage that contains the calendar from within the plugins?The build-in
How can I submit the form right after a date is picked? To submit the form associated with the current date field (the one you passed
in as a parameter of fPopCalendar), you should use the following code in
To submit a static form named as "testForm", you may use:
How can I reset the system defined "today" to a date specified in the server-end?The calendar engine uses 2 system objects 1st, you need to prepend the following lines of code to the top of
2nd, you need to search through the theme-name.js file,
e.g.
Finally, you may want to rename the plugins file to
Remember to modify the name & id of the calendar iframe tag accordingly to reflect the above renaming - e.g. Also note that all options in the theme-name.js can be reset dynamically in this manner. How come the widths of calendar columns look different in size after I reconfigured the theme?Please check whether the upper Navigation Section or lower Today Section is wider than the total width of date cells. The calendar panel will automatically get stretched if the outter table width becomes larger, and the streched part might not be evenly distributed among all columns. You may either enlarge the How to set the date range to begin from today?Simply set the
Why IE6 began to show strange white space along the right and bottom sides after I added a DOCTYPE! statement?It's a bug of IE6 when setting the border style of <iframe> tag in
standard mode. To workaround, you may remove the border style from the <iframe>
tag and put it into the
I would like to use images instead of the text numbers for the date numbers. Would this be easy to do?Yes, easy. There is an option in the
and set the
Note the The calendar is obscured by another iframe in the same page when browsing with Opera 7, what's wrong?Opera 7 seems to have a z-index bug and layer the iframe objects only by loading sequence. To work around, simply move the calendar iframe tag from the page bottom to page top, as following: <BODY> NOTE that you mustn't move the How can I make Monday/Sunday the first day of week?Easy. There is an option in the How can I have a default tooltip message for every normal date?Easy. Just need to add 1 line of code in
How to intercept input/output to create date format like "Monday, August 18, 2003"?Although most common date formats can be easily set via the theme options, sometimes user do need special customized ones. It's not difficult as long as you know how to intercept the input and output of the calendar. Now let's illustrate the process of setting a format of "WEEKDAY, MMM DD, YYYY", which is not directly supported by the theme. 1st, set the theme date format to be "YYYY-MMM-DD", as following
2nd, add the following to your
Note: These 2 plugin functions are the new features that are only available after version 8.2. Please check the Plugins SDK for details. How can I organize theme files in a different directory other than the default engine directory?In the calendar tag, you need to change the value of name & id properties to include the absolute/relative path to the theme directory. e.g.
The above tag will load the normal theme from absolute web path How come the calendar stops working in NN4 once I add in the Thawte certificate seal?It's a bug of the Thawte seal script and can be easily fixed by appending a line of script right behind it. i.e.
The 1st Why the calendar doesn't close after a date is selected?Check the theme-name.js file and look for the Where can I find a working example for the calendar working with asp.net tabstrip/multipage controls?Please try the following one. Note the form id must be set to the same
as the one passed in to TabStripDemo.aspx
Put the above TabStripDemo.aspx into a virtual directory on your IIS with the supermini theme for PopCalendarXP and normal theme for FlatCalendarXP. Note: If you don't want to set the
How can I use the functions defined inside the calendar engine?You can reference anything inside the calendar engine by prefixing it with the engine's context name (more on this in the Hello World tutorial). e.g.
NOTE: the context name (e.g. gfPop or gfFlat) will be only available after the engine is fully loaded. You may want to check it before calling by adding "if(self.<ContextName>)" to the above statement, otherwise you may get an "object not found" error upon an inmature loading. How to set a default date?If you need a default date, assign one directly to the
How to prevent the user from editing the date field directly?You just need to set the input box to be readonly by appending [
Now the value of this field can only be set by scripts and you don't need to worry about user typing in wrong date any more. How to pass parameters to the scripts that generate the agenda file?If you want to create a calendar that belongs to a user, you may need to pass the user id to the scripts that generate the agenda file so that the calendar only shows up the events related to that specific user. CalendarXP has already taken it into account and all you need is set the url in the name & id of the calendar tag, as following:
The above example is using JSP to generate the agenda file, of course you may use Perl, ASP, PHP or whatever else instead. Note: you must escape any non-alphabetical chars in the URL, especially the colon char. Running the parameter string through an URL encoding filter and using the transformed string in the name & id of the calendar tag is always a safe way to go. Can I use the week number to launch an action, like the day number does?Yes, any actions can be associated with the week numbers, e.g. popup windows, change url or even update calendar events. There is a plugin in the plugins.js file:
Now you may do whatever you like in the fOnWeekNo() function. It'll be called every time when you click on the week numbers of the calendar. How to change the size of the calendar?The calendar size is determined by the calendar cell size and the padding and spacing size of the panel table. They can be adjusted easily by editing the following options in the theme-name.js file: giCellWidth, giCellHeight, gsInnerTable, gsOuterTable. The calendar panel looks like being squeezed in Konqueror sometimes. What's wrong?It's because sometimes the Konqueror has difficulty in expanding the calendar panel to the correct size. Currently it can be worked around by giving the iframe tag a larger-than-usual width value since it appears to have no problem in shrinking automatically. e.g. Why the prev/next month links only respond to the first click in Konqueror?It's a bug of certain Konqueror version. This bug exists outside the calendar engine and you may test it with any simply link on a blank page - the onclick event will not be fired after your first click unless you move the mouse out of the link and back in again. Currently it can be worked around by using It looks like this bug only occurs on anchor links, it's not affecting buttons. I got a "gfPop is undefined" error, what's wrong?It means that the calendar engine has not yet been loaded when you try to popup the calendar. Please check your calendar tag first and make sure the There is another possibility that you will see this error - if your page took a long time to load and the user tried to trigger the popup before the page is fully loaded. This usually is not an issue because it'll be working fine after the page finishes loading. If you really don't want to see this error, you may simply prepend "if(self.gfPop)" condition check to the onclick event handler. e.g.
How to prevent the calendar from being switched to prev/next months when a day of them is selected?You need to put 4 lines of code into the fOnChange() plugin function. e.g.
So afterwards, clicking the dimmed days that belongs to prev/next months will no longer automatically switch the calendar. Why I start loosing onblur events on my text boxes after using the hide-calendar-on-clicking-document script on IE?It's a bug of IE, all other browsers work fine without any problem. To work around, you just need to append one more line as following to the document.onmousedown event handler in your page.
Why the calendar is mis-aligned in a tab control after I inserting another relatively-positioned html tag into a table in the same page?It's a CSS bug of IE6 only, and doesn't exist in earlier versions of IE. To work around, you just need to give the tab page tag that contains the date field a style of at least 1px padding. e.g. If the tab page is a
How to select multiple dates in one calendar?There is a new call-back function in the plugins.js called To select multiple dates, you just need to create an array in the plugins.js to store either the selected dates or the selected date range. The array takes values via How to create a holiday for Easter Day?Please have a look at the setup agenda and holidays tutorial, it's detailed there. Why the fOnChange() and fAfterSelected() plugin functions not working?Please check the Why the month navigators created in my new theme don't do auto-traverse?You just need to give your month navigator tags an id of "navPrev" or "navNext" and the calendar engine will then find them and start auto-traverse when you holding down the mouse button on them. Take a look at the existing themes for a sample. How to disable the dates-out-of-range alert message boxes?In the theme-name.js file you may find an option called How to keep the day of month selected when the month or year gets changed?In the plugins.js file add some extra code to the
How come in Safari the calendar events text rides on top of day number instead of underneath?It's a CSS bug of Safari, and doesn't exist in other browsers. It's related to the way how Safari handles the CSS rule of "display:table-row". To work around, you'll have to wrap another
NOTE: You may ask why wrapping it conditionally(only when Safari is detected)? The answer is IE6 doesn't like such wrapping for some reason and will choke on it. How to set the date range to start from today and end 7 days later?Check for
NOTE: The month number used in the javascript Date object is ranged from 0 to 11. How to set the disabled or out-of-range dates in a special style other than line-through?To get rid of the line-through effect on disabled or out-of-range dates, you just need to append the following line to the plugins.js file:
By default the engine only provides 2 theme options to config the tooltip and background image of the out-of-range dates -
Make sure you have set the How to adjust the algorithm of week numbers?The default algorithm employed is ISO8601 standard, which means Jan 1st will belong to the last week of last year if it falls in the last 3 days of a week. To make it more flexible, now you may re-define the The day-of-week location of Jan 1st will be passed in as the only parameter. This location is a number of between 0 and 6 that denotes one of the 7 day-of-week columns of the calendar from left to right. Say you want that Jan 1st should be taken into the week no.1 of the current year only when it falls between Monday-Friday, and the
If the
How to populate the selected date into 3 dropdown boxes for a separated year, month and day?Please refer to the bundled Classic Demo for details. How can I de-select a date?In most themes, all you need is to clear the
Then call it whenever you want to remove the selected date from the calendar. Note, some themes may use additional variable to store multiple selected dates, and you just need to clear them in the same call. Why the calendar works great in demos but doesn't show up or is offseted at a weird location on my page in IE6?Most likely you are using the calendar within a relative-positioned tag, and this is a well-known css bug of IE. To work around, you just need to add the following rules to your css file (suppose the id of the relative-positioned tag is
It's also known as "Holly Hack", you may follow the link for details if you are interested. How can I create the calendar iframe tag dynamically using javascript?Some of our customers are interested in creating the calendar tag dynamically instead of having it written statically at the page bottom. The following code can do the trick on IE5+, Opera 7.54 and most Mozilla based browsers:
It's not fully tested on every platform, but you got the idea on how to do it. Why the calendar doesn't show up after I chose to use the onmousedown event instead of onclick to trigger the calendar? Since version 9.0.236, the engine has built-in support to hide the calendar panel if user clicks on places other than the trigger element. Nonetheless, if you use the
If you choose the css way, you don't even have to define the
The marker wouldn't change the appearance at all, but if you don't mark it the calendar may not be able to show up. The engine needs to know the trigger tag (most of the time it's just a calendar image, but could also be a textfield or anything you use to take the mouse clicks) so that it will show, instead of hide, the calendar upon clicking. However, you can't use this approach with NN4 since NN4 doesn't support multiple css classes. To take NN4 into account, you must either rename the
How to create 2 different calendars in one page?Although in most cases we only need 1 calendar engine tag (iframe) in page, it doesn't mean we are restricted to it. Sometimes we need 2 calendar pickers with different behaviors or looks, and the following steps to get them work:
This way, you can have one picker with format "YYYYMMDD" and the other with "DD/MM/YYYY", preferrably with different looks. You can even have different agendas assigned to each calendar if you like - just name them separately as agenda1.js and agenda2.js. All can happen in the same page. How to validate the date keyed in by user?If you allow user to key in date string directly, you may want to validate it. The easiest way is to use the built-in functions of the calendar engine to do the job:
IE 6 on WinXP SP2 raised an alert and blocked the calendar when I tried to view the demo, what's wrong?Relax, that's the new script blocker introduced in IE6 of WinXP SP2. The alert will show up whenever you try to access a javascript page from local file explorer. However, it doesn't seem to affect the page on a real website. We've tested the calendars on different websites and haven't seen any alert. Please take a look at our online demos to get a peace of mind. How can I pre-select a date and format it in the corresponding date field?You'll need the following function and have to call it in the
Of course, you can replace the How to enable the user type-in box for the year in themes other than the contrast theme?Since version 9.2 a new feature has been added to the contrast theme which allows the user to type-in the year quickly. You can easily apply it to other themes by appending the following code snippet to the plugins.js: (You may remove the previous definition of
Then append the following to the css file of the corresponding theme:
Finally, call the
Of course you may change the size or color to match you local theme . How can I control the sliding-out pop effect?Sliding-out effect currently only works fine on IE and NN4. Although Mozilla also supports the function, it's just too slow to slide out smoothly, thus it's turned off on Mozilla by default. You can control whether to use the sliding-out effect by setting the
Copyright© 2003-2007 Idemfactor Solutions,
Inc. All rights reserved.
| ||||