Date select helpers should have a :prompt option
Reported by samoli | July 7th, 2008 @ 12:54 PM | in 2.x
It should be possible to include a custom :prompt with the date select helpers in the same way you can include one with collection_select.
Including a prompt as the first select option is common practice when using date selects. Without this feature it's tricky to use the date select helpers if you need a custom prompt.
I've included a patch with tests and documentation. With this patch you can pass custom prompts as a hash, or pass true for a generic prompt (Day, Month, Year, Hour, Minute, Seconds).
Example:
date_select("post", "written_on", :prompt=>true)
date_select("post", "written_on", :prompt=>{:day=>'Select day', :month=>'Select month', :year=>'Select year'})
Comments and changes to this ticket
-
joffwilliams July 7th, 2008 @ 02:09 PM
+1 from me. date select is a great helper but lacks this prompt option.
-
-
Joshua Peek October 28th, 2008 @ 04:22 PM
- → State changed from new to stale
Interesting, I will have to go in after 2.2 though. Lets relook at it then.
-
grant November 3rd, 2008 @ 11:06 PM
Thanks! I'm glad I searched before writing that myself. Here's a version of the patch that applies cleanly to 2.1.2.
-

Jatinder Singh November 13th, 2008 @ 10:01 PM
+1 We should probably have a similar approach to assign different CSS class name to each select generated. or is that something possible already?
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Source available from github
The Git repository resides at http://github.com/rails
Check out the current development trunk (Edge Rails) with:
git clone git://github.com/rails/rails.git
Creating or reviewing a patch
See the contributor guide.
Creating a feature request
Please don't. If you want a new feature in Rails, you'll have to pull up your sleeves and get busy yourself. Or convince someone else to do it. See the contributor guide on how to get going. But posting them here is just going to lead to ticket root.
Creating a bug report
When creating a bug report, be sure to include as much relevant information as possible. Post the code sample that causes the problem. Preferably, alter the unit tests and show through either changed or added tests how the expected behavior is not occuring.
Security vulnerabilities should be reported via an email to security@rubyonrails.org, do not use trac for reporting security vulnerabilities. All content in trac is publicly available as soon as it is posted.
Then don't get your hopes up. Unless you have a "Code Red, Mission Critical, The World is Coming to an End" kinda bug, you're creating this ticket in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the ticket automatically will see any activity or that others will jump to fix it. Creating a ticket like this is mostly to help yourself start on the path of fixing the problem and for others to sign on to with a "I'm having this problem too".
