Ben Vinegar home projects archives about

Bare bones date picker for Merb

June 29, 2008

I’ve been fooling around with Merb these past few months. Can’t say I’ve created anything of consequence, but along the way I’d written this simple date picker, and thought I’d share it.

Used inside a form_for block, it creates 3 separate drop-downs for year, month, and day from a Time object.

Example:

<% form_for @person %>

  <%= date_control :birthdate, :label => 'Birthdate' %>

<% end %></code

Note: This should be run against Merb 0.9.3.

Edit: Jamie Macey (below) has contributed an updated version for Merb 0.9.4.

blog comments powered by Disqus
Fork me on GitHub