# Blanks in date\_select need configurable text

**URL:** <https://www.ruby-forum.com/t/blanks-in-date-select-need-configurable-text/155389>\
**Category:** Rails\
**Created:** [December 11, 2008, 11:16am UTC](https://www.ruby-forum.com/t/blanks-in-date-select-need-configurable-text/155389 "2008-12-11T11:16:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martijn\_Vos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e8c25b/32.png) [@Martijn\_Vos](https://www.ruby-forum.com/u/Martijn_Vos)\
**Post date:** [December 11, 2008, 11:16am UTC](https://www.ruby-forum.com/t/blanks-in-date-select-need-configurable-text/155389/1 "2008-12-11T11:16:00Z")

</div>

I thought I’d mailed this already, but I haven’t seen it show up  
on the list, so I’m mailing it again. My apologies if it does  
show up twice now.

I want something really simple: I want a date\_select that has  
blanks (:include\_blanks works fine so far), but having an empty  
value in the select box on the webpage is ugly, so I want something  
more informative there, like “month” or “select a month” or something.

In other words:

Month January February March April May June July August September October November December

How do I do that? I can’t find any way to accomplish this in any  
docs nor in the source, yet it seems like a really obvious thing  
to want to do.

Martijn.

---

<div class="post-metadata">

**Author:** ![Martijn\_Vos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e8c25b/32.png) [@Martijn\_Vos](https://www.ruby-forum.com/u/Martijn_Vos)\
**Post date:** [December 11, 2008, 12:08pm UTC](https://www.ruby-forum.com/t/blanks-in-date-select-need-configurable-text/155389/2 "2008-12-11T12:08:54Z")

</div>

There is an option prompt like  
\<%= select(“model”, “status\_id”, Status.find(:all).collect {|p| [  
p.name, p.id ] },options ={:prompt =\> “\<\< Select any \>\>”}) %\>

I think you can do similarly

Sijo

---

<div class="post-metadata">

**Author:** ![Martijn\_Vos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e8c25b/32.png) [@Martijn\_Vos](https://www.ruby-forum.com/u/Martijn_Vos)\
**Post date:** [December 11, 2008, 12:38pm UTC](https://www.ruby-forum.com/t/blanks-in-date-select-need-configurable-text/155389/3 "2008-12-11T12:38:11Z")

</div>

On Dec 11, 2008, at 12:08 PM, Sijo Kg wrote:

> There is an option prompt like  
> \<%= select(“model”, “status\_id”, Status.find(:all).collect {|p| [  
> p.name, p.id ] },options ={:prompt =\> “\<\< Select any \>\>”}) %\>
> 
> I think you can do similarly

Doesn’t seem to work in date\_select. And throwing away the  
power of date\_select in order to handle everything myself seems  
like a bad idea. I’d rather add this functionality to date\_select.

Martijn.

---

<div class="post-metadata">

**Author:** ![Martijn\_Vos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e8c25b/32.png) [@Martijn\_Vos](https://www.ruby-forum.com/u/Martijn_Vos)\
**Post date:** [December 11, 2008, 1:21pm UTC](https://www.ruby-forum.com/t/blanks-in-date-select-need-configurable-text/155389/4 "2008-12-11T13:21:08Z")

</div>

On 11 Dec 2008, at 11:37, Martijn Vos wrote:

> Doesn’t seem to work in date\_select. And throwing away the  
> power of date\_select in order to handle everything myself seems  
> like a bad idea. I’d rather add this functionality to date\_select.

If you’re worrying about good UI, date\_select is pretty horrible  
anyway. Would be something of a lipstick on a pig thing.

Fred

---

<div class="post-metadata">

**Author:** ![Martijn\_Vos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e8c25b/32.png) [@Martijn\_Vos](https://www.ruby-forum.com/u/Martijn_Vos)\
**Post date:** [December 11, 2008, 1:56pm UTC](https://www.ruby-forum.com/t/blanks-in-date-select-need-configurable-text/155389/5 "2008-12-11T13:56:31Z")

</div>

On Dec 11, 2008, at 1:19 PM, Frederick C. wrote:

> > power of date\_select in order to handle everything myself seems  
> > like a bad idea. I’d rather add this functionality to date\_select.
> 
> If you’re worrying about good UI, date\_select is pretty horrible  
> anyway. Would be something of a lipstick on a pig thing.

Until I needed to add a nil option, date\_select worked fine for  
me. What’s so wrong with it (other than this particular issue)?  
And is there a better alternative availlable?

Thanks,  
Martijn.

---

<div class="post-metadata">

**Author:** ![Martijn\_Vos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e8c25b/32.png) [@Martijn\_Vos](https://www.ruby-forum.com/u/Martijn_Vos)\
**Post date:** [December 11, 2008, 2:00pm UTC](https://www.ruby-forum.com/t/blanks-in-date-select-need-configurable-text/155389/6 "2008-12-11T14:00:03Z")

</div>

On 11 Dec 2008, at 12:55, Martijn Vos wrote:

> > > > I think you can do similarly  
> > > > And is there a better alternative availlable?  
> > > > People have a hard time working with stuff like ‘20th december’. Is  
> > > > that a saturday or a sunday etc… Or they’re thinking in terms of  
> > > > ‘next monday’ and things like that, in which case it’s a lot simpler  
> > > > if they don’t have to do the date maths themselves.

Fred

---

<div class="post-metadata">

**Author:** ![Martijn\_Vos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e8c25b/32.png) [@Martijn\_Vos](https://www.ruby-forum.com/u/Martijn_Vos)\
**Post date:** [December 11, 2008, 2:45pm UTC](https://www.ruby-forum.com/t/blanks-in-date-select-need-configurable-text/155389/7 "2008-12-11T14:45:52Z")

</div>

On Dec 11, 2008, at 1:59 PM, Frederick C. wrote:

> > > >
> 
> People have a hard time working with stuff like ‘20th december’. Is  
> that a saturday or a sunday etc… Or they’re thinking in terms of  
> ‘next monday’ and things like that, in which case it’s a lot simpler  
> if they don’t have to do the date maths themselves.

Point taken. But I’m using date\_select for birth dates, so for me  
days of the week aren’t much of an issue. I just don’t want to  
force a default birth date on people who are unwilling to provide  
it. The day-month-year combo of date\_select seems perfect for me  
so far, except for the inability to provide a nice text for the  
empty value.

Martijn.
