Fixing the Jenia4Faces Popup Calendar in Firefox

Our company is still using a mash of technologies in our JSF 1.1 website.  We’ve always liked the Jenia4Faces calendar popup component for its ease of use.  However, development on that code appears to have ceased long ago and we’ve been bitten by a javascript bug that causes the popup calendar to close unexpectedly in firefox whenever the previous month/next month buttons are clicked.

Since the javascript is contained within the jenia4faces_1.2.1.jar library, you first must decompress the file to edit the code.  One way to do this is to change the .jar extention to .zip (since a jar file essentially is a zip file).  Then I use ZipGenius (on windows) to extract all the files into an empty directory.  Next, browse to \path_to_decompressed_files\popup\popupCalendar\js\popupCalendar.js.

At the top of the file, in the showPopupCalendar() function, is a call to registerClickListener(“hidePopupCalendar”) as shown below (note that the code has been formatted for this post. It’s slightly more compact in the actual file).


function showPopupCalendar(DateRef, EventRef, DisableNone, LangID, Format, ImagePath, hposOffset, vposOffset, ondateselected) {

if (PC_disp) return;
 else {
 PC_disp = true;
 if (popupCalendarForm != null)popupCalendarForm.parentNode.removeChild(popupCalendarForm);
 hidePopupCalendarFunction();
 }
//    registerClickListener("hidePopupCalendar");
 PC_onDateSelected = ondateselected;
 PC_ho = hposOffset;
 PC_vo = vposOffset;

...

Comment out the call as shown above and month navigation will be restored in Firefox.  Note that there is a consequence for doing this.  The intention of this code is to close the popup when the user clicks elsewhere on the page, and it works great in IE.  Disabling this code will break the feature of closing the popup by clicking outside if its frame in both browsers.  The user will have to select a date or click “none” to close it.  For us, this is a minor issue.

I hope this will help someone else using this stack whom was surprised by the same bug.

Advertisements
This entry was posted in Code and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s