[Looking for Charlie's main web site?]

Having issues with the popup calendar feature in CF11 or 2016? There's a fix

If you're using the cfinput type="datefield" feature to popup a calendar and are finding that it's a) not working *at all* in ColdFusion 2016 or b) it showing up but not *correctly* after ColdFusion 11 update 12 or ColdFusion 2016 update 4, there's a fix for both.

The first problem was introduced in the CF2016 installer released in Dec 2016, and any after that, where Adobe has literally removed the library used for the calendaring, but you can add it back, as I discuss below. (If you install or installed CF 2016 from the original installer in Feb 2016, you won't see this problem as it wasn't removed then.)

The second problem was introduced in those two named updates, and was fixed in the very next updates (CF11 update 13 or CF2016 update 5). And of course, this could also happen if you're moving to CF11 or 2016 for the first time, and someone else had "fully updated" those to that update level before you started testing against it.

If you'd like to know more, read on.

The first issue, where it doesn't work at all

As for the first problem, where the calendar just doesn't work at all on CF2016, again this is based on which installer you are using. If the original from Feb 2016, you won't see this. If the one from Dec 2016 (or later), you will, because Adobe removed the underlying javascript library (YUI) that supported this calendar (and some other UI elements). They also removed the libraries supporting the Spry and portlets features.

This is discussed in the Adobe blog post about this new installer in December 2016.

The good news (for those who need this to work, as part of a move to CF2016 perhaps, where they want to minimize effort in making the move), that Adobe blog post (and a related technote) offers a link for you to download that YUI library to put the feature back.

It is a bit curious how all this happened, because they had announced with the release of CF2016 that they were merely going to "deprecate" (not obsolete) these things as of CF2016. This is the first time I can recall that a feature was obsoleted like this with simply a new version of the installer, and not a specific update or new version.

The second issue, where it works but not correctly

This issue is discussed in a CF bug entry, CF-4198570, but since I've had a couple of customers recently ask for help on it, I thought I'd bring it up in a blog post here. (I had written this during that timeframe before the next updates fixed the problem, and I was highlighting a work-around available at that time, as well as offering code to demonstrate the issue. I am leaving that part here in case it may help anyone somehow unable to apply the needed update that fixes the problem.)

And note that this is about the HTML-based (javascript-based) calendar, not the older Flash one. Finally while I don't show this being within a CFCalendar tag, it can be used there also, with the same problem.

Here's some very rudimentary code to demonstrate the feature and the problem if you were to run it in the affected updates.

<!--- page calls itself by default, by there being no ACTION attribute--->
<cfform>
<cfinput type="datefield" name="test" mask="YYYY/MM/DD">
<br><br>
<cfinput type="submit" name="submit">
</cfform>
<cfdump var="#form#">

When things work, once you select a date it should fill it into the field (whose format can be controlled with that MASK attribute).

When the problem is happening, you'll find first that the field is populated with a mask (unexpectedly), and more important it is NOT filled in when you select one from the calendar. Also, you may notice that when you click in the date input field, you may see some additional icons within it on its right side, in addition to the little calendar icon that should appear just outside of it. (The problem seems to happen in Chrome more often than other browsers, at least for some users I've talked with.)

The original workaround to this second problem

The issue was originally discussed in the CF bug entry, CF-4198570. And again since then, you can just go to the next CF update and it fixes the problem. (Note that the bug report's title indicates that this is a CF11 problem, but it was found ultimately to indeed apply to CF2016 also.)

But if you are somehow stuck on CF11 update 12 or CF2016 update 4, the workaround was to obtain a special hotfix jar file, either the one for CF11 or the one for CF2016. (If you find that just clicking the link shows you gibberish in your browser, right-click the link and save the file instead.) Then you were to put that saved jar in the lib\updates folder for your instance(s), and restart CF, and the problem would go away.

(If you're not clear about the location of where to put the update jar file, for a typical Windows installation the CF2016 location would be C:\ColdFusion2016\cfusion\lib\updates. You'll see that that folder holds the jar file for whatever update may have been previously applied. Again, restart CF after making that change before testing if the problem is fixed.)

If you have updated to CF11 update 13 or CF2016 update 5, and had applied that workaround jar, you can and should remove it. (While I noted in my first version of this post, in July 2017, that the CF update mechanism would automatically remove any manually placed hotfix files like this, an Adobe rep let me know elsewhere that was not the case. I have not tested to confirm.

Conclusion

Finally, about both the issues above, I want to say that this blog post is not the place for us to belabor the discussion of how and why people should be discouraged from using the various javascript-based UI tags and features. Both the issues above are certainly more reasons folks should consider that, as is the aforementioned deprecation. The writing is indeed on the wall.

Still, my role is that of a CF Server troubleshooter, and when someone comes to me wanting to fix this problem which may be preventing them going forward with an update or migration, they don't want to hear "remove all the CF UI tags and replace them with a better javascript library to do such things". But I realize some think that's what should be said always to anyone ever using them. :-)

Comments
Copyright ©2017 Charlie Arehart
Carehart Logo
BlogCFC was created by Raymond Camden. This blog is running version 5.005.
(Want to validate the html in this page?)

Managed Hosting Services provided by
Managed Dedicated Hosting