The new and improved Date Picker!
The new and improved Date Picker!
In January of 2004 I wrote an article called The JavaScript Date Picker. This was before DMXzone included the code and essential files with your article. The date picker was pretty good, but some people had problems with copying the code and implementing the widget.
Nowadays you get the whole kit and caboodle when you buy an article. Secondly, while the date picker itself was pretty decent, there were a couple of issues I didn’t like about it. I guess you could say I gave you a foundation but not a whole working widget you could drop into your pages. This article aims to fix that by providing you with an updated, better working calendar which you can drop right into whatever project you are using. Included will not only be the code, but the graphics files, HTML and CSS as well. And you can be sure this is something you can use in production. I just finished implementing this very code into a rather large project in my 9-5 job, and it has been thoroughly tested. (Our QA department is very picky!)
With this new script, I’ll be talking more about what the script does and how it works and a little bit less about the Date object. So if you are rusty or inexperienced with the Date object, you could review the other article as well.
Overview
Problems with the last version
There are a few things we need to fix from the last version. They are:
- Where does the calendar really pop up? It needs to work on any page. This will be solved by centring the calendar DIV on the page when the user clicks the widget icon.
- The last version allowed people to pick dates in the future, which can cause problems on some systems. We’ll disallow that (and show you how to keep it if you don’t mind).
- We needed to spice up its looks!
- We needed to fix an error where the user enters an invalid date in the text box, and then clicks the calendar icon – thus breaking the calendar.
We’ll fix all these problems and streamline the code a bit in this version. Note, we’ll be dealing with date’s in U.S. time format (mm/dd/yyyy).
Reviews
RE: not all the information is provided
Hi there, I'll try and find out what is going on - all the stuff should be for download somewhere - sorry about the trouble. Tom
You must me logged in to write a review.