Tip #3 - Sexy Date Select Fields!
Sat Apr 12 11:31:45 -0700 2008
Tired of having 5 different pick lists or spinners to set a date on your form? Me too, that’s why calendar_date_select was made, and it’s soo easy to install…

Besides, doesn’t this select box look much better and more user friendly than entering e-v-e-r-y – s-i-n-g-l-e – b-i-t – o-f – t-h-e – d-a-t-e?? Aren’t we web 2.0 here?
First, download the calendar_date_select files and unzip them and put them into your public/javascripts directory.
Then put the stylesheets you want into the public/stylesheets directory.
Then in your layout/application.html.erb file put the following in the
section of the layout:So it would look something like this:
1 2 3 4 5 6 7 8 9 |
<html> <head> <%= javascript_include_tag :defaults %> <%= javascript_include_tag "calendar_date_select/calendar_date_select.js" %> </head> <body> <%= yield %> </body> </html> |
Then, in the form that you want to have the date select field, type something like this:
1 2 3 4 5 6 |
<%- form_for @task do |f| -%> <%= label :subject, "Subject" -%> <%= f.text_field :subject -%> <%= label :due_time, "Due Time" -%> <%= f.calendar_date_select :due_time, 1.day.from_now -%> <%- end -%> |
Now, when you go to enter a date, you get a funky pick box pop up instead of the spinners.
Neat-O!
As a bonus, you get a simple text-field box that you can just type the date if you don’t want to open the pick box, so typing “4 March 1974” will select the right date when you save the form.
blogLater
Mikel
Latest posts
- Encrypting Another Partition Using FileVault 2 on OSX Lion
- Installing Home Folder on Second Drive on OSX Lion
- undefined local variable or method `version_requirements'
- A New World of Resources
- Rails Static Pages
- Twitter Replacing Rails? So?
- Engine Yard Cloud Backups Generating Zero Length Backups
- Our Rails Rumble Entry - StillAlive.com
- Renaming a controller and redirection in Rails 3
- Updating RailsPlugins.org to Rails 3 - Part 1
- A new protocol for social interaction
- What is a distributed social network?
- Bundler and Public Git Sources
- Getting Heroku, memcached and Rails 3 working
- Why Bundler?
- Rails Commit Access
- Introducing TellThemWhen
- rake RSpec & Cucumber uninitialized constant Rails::Boot::Bundler
- This Relationship is Worth Nothing
- Thank YOU...
- Inline Attachments for ActionMailer
- Upgrading RailsPlugins.org to Rails 3 - Part 1
- Stripping dollar signs and commas from a string
- Getting Rails 3 Edge with jQuery, RSpec and Cucumber using RVM
- Action Mailer, go Proc thyself
- The Real News Donation Drive
- ActionMailer ScreenCast and Article
- Installing RSpec for Rails 3
- I am speaking at RailsConf 2010
- Rails 3 Session Secret and Session Store
- If you're lazy and you know it write your specs!
- Bundler - uninitialized constant ActionController
- Bundle Me Some Sanity
- How to use Mail / ActionMailer 3 with GMail SMTP
- Put your mailer where the action is!
- Why Force a Choice?
- How to make an RSS feed in Rails
- Rails 3 Routing with Rack
- Bundle me some Rails
- Helping out in Haiti
- Watch your self
- Is Rails 3.0 a Game Changer?
- Where did the scripts go?
- validates :rails_3, :awesome => true
- New Rails Version 3.0 Guides Online
- New ActionMailer API in Rails 3.0
- Mail gem version 2 released
- How to rename a Rails 3 Application
- Rails 3.0 Examples
- DECCA Driving Day
Latest comments
- buy camel cigarettes
Wonderful blog! I definitely lo...
- how to become a pilot
About this topic, I have been l...
- how to become a pilot
About this topic, I have been l...
- best cigarettes
This was a fantastic post. Real...
- best cigarettes
This was a fantastic post. Real...
Categories
Tag Cloud
AJAX ARGH! ActiveRecord Ajax Apache Apple Asterisk Australia Copy Database Development Feedburner Gem server Google Human Rights Javascript L. Ron Hubbard MS SQL Server MacOSX Mail Mephisto Not Programming OpenBSD Opensource Performance Personal Integrity PostgreSQL Programming Prototype Puzzle RDoc REST RESTful Rails RSPec RSpec Rails Rails Tips Rspec Ruby Ruby on Rails Ruby on Rails Tips Ruby on rails Tips SQL SQLServer SVN Scientologist Scientology Site Stats Soekris Soekris net5501 TMail Textmate Tips Windows World about mikel anti drug apache contributing daemon documentation drugs illustrator javascript lambda mail mephisto newspapers nitro open source opensource photoshop productivity programming railscasts rspec ruby ruby on rails rubyforge scientology seo sitemap sqlserver tips tmail tom cruise unix tricks vector graphicsArchives
- November 2009 (1)
- October 2009 (2)
- September 2009 (2)
- August 2009 (0)
- July 2009 (1)
- June 2009 (0)
- May 2009 (1)
- April 2009 (0)
- March 2009 (0)
- February 2009 (0)
- January 2009 (2)
- December 2008 (0)
- November 2008 (5)
- October 2008 (0)
- September 2008 (1)
- August 2008 (0)
- July 2008 (2)
- June 2008 (13)
- May 2008 (7)
- April 2008 (18)
- March 2008 (8)
- February 2008 (5)
- January 2008 (7)
- December 2007 (20)
- November 2007 (22)




Leave a Reply