One of the functional requirements for the voter registration application I blogged about recently was that the application should not allow further registrations between the registration deadline (October 16 at 9pm) and a date after the election specified by the state Board of Elections. For the initial run of the application, I simply hard-coded the deadline and restart date into the application logic, knowing full well I couldn't leave it that way unless I wanted to personally change the code year after year....which I don't.
So this week I set out to write a tool within the administrative interface of the application that would allow a non-programmer to update the deadline and restart date every year. The jQuery UI Datepicker widget is my tool of choice when it comes to having users enter or edit a date, but I've used a few different approaches to having users enter a time of day. This time around, I decided to see I if could find something comparable to the Datepicker widget for setting the time.
What I found was a rather sweet plugin called the Timepicker Addon that adds a set of time controls to the jQuery UI Datepicker. If you customize your jQuery UI download to include both the Slider and Datepicker widgets, you can present the time controls as sliders, like so (without the Slider widget, you get select boxes):
The plugin comes with a number of configuration settings so you can do things like adjust the time increments, change how the time is displayed, and allow the user to denote the time zone associated with the time value. Once I had the plugin configured the way I wanted, I simply had to write some code to validate the date and time string submitted from the form field, and I was done. Very cool.
applets in an application I inherited. One of the applets was a
collapsible hierarchy tree of organizational units that used the
conventional triangle icons (pointing right for closed, pointing down
for open) to indicate state.
In past applications, I'd simply created actual triangle icons of the
appropriate color for this sort of thing, but this time I decided I
wanted to do it in pure CSS.
Saw on Twitter this morning (via tweets from Sean Corfield and Billy Cravens) that FW/1 now supports environment-specific variables. This new feature is described in detail on the FW/1 "Developing Applications Manual" wiki page.
Sean will probably do a proper blog post about the new feature (which I think is a great addition to the framework), so I won't bother restating what's covered in the documentation.
But I did want to bring up one use case that's not explictly discussed: you could use the new public API function getEnvironment() in your controller function or views to modify application behavior based on on the environment name returned by that function. I've been using environment-specific behavior in my apps for a while now (configuring the environment variables in a ColdSpring bean), and it's a useful option to have.
Normally I don't blog about the actual ColdFusion web applications I
create at the University of Maryland College Park (UMCP). Most of them
are extranet applications inaccessible to the public and computerize
business processes that would take too long to explain. But my most
recent application doesn't fit the normal mold and it's received some attention from the local media because of what it does.
The application is an online application form for registering to vote
in the State of Maryland in November designed specifically for our
students at the university. It was commissioned by our undergraduate
Student Government Association (SGA) as part of a larger, multi-faceted
effort to get out the vote this year, and supported by the university
administration and the State Board of Elections (who provided the
guidelines for how the data would be collected and sent to them).