# Date\_select Year as a text\_field

**URL:** <https://www.ruby-forum.com/t/date-select-year-as-a-text-field/192485>\
**Category:** Rails\
**Created:** [July 31, 2010, 2:28am UTC](https://www.ruby-forum.com/t/date-select-year-as-a-text-field/192485 "2010-07-31T02:28:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/bbe5ce/32.png) [@cam](https://www.ruby-forum.com/u/cam)\
**Post date:** [July 31, 2010, 2:28am UTC](https://www.ruby-forum.com/t/date-select-year-as-a-text-field/192485/1 "2010-07-31T02:28:01Z")

</div>

Hey all,

Using date\_select in a form, how can I make the Year field a  
text\_field instead of a select? It looks like it will take more than a  
simple modification of the date\_select method.

Thanks in advance.

Cam

---

<div class="post-metadata">

**Author:** ![cam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/bbe5ce/32.png) [@cam](https://www.ruby-forum.com/u/cam)\
**Post date:** [July 31, 2010, 8:11am UTC](https://www.ruby-forum.com/t/date-select-year-as-a-text-field/192485/2 "2010-07-31T08:11:56Z")

</div>

Hi,

It is simple, but it’s not straight forward.  
You just need to discard the year from select and add the proper name to  
the text field for year.  
You can refer it here for better example with code  
[http://rubyonrailshacks.com/2010/07/how-to-modify-date\_select-to-show-text-field-for-year/](http://rubyonrailshacks.com/2010/07/how-to-modify-date_select-to-show-text-field-for-year/)

regards,  
Sur  
[http://rubyonrailshacks.com](http://rubyonrailshacks.com)

Cam wrote:

> Hey all,
> 
> Using date\_select in a form, how can I make the Year field a  
> text\_field instead of a select? It looks like it will take more than a  
> simple modification of the date\_select method.
> 
> Thanks in advance.
> 
> Cam

---

<div class="post-metadata">

**Author:** ![cam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/bbe5ce/32.png) [@cam](https://www.ruby-forum.com/u/cam)\
**Post date:** [July 31, 2010, 10:25pm UTC](https://www.ruby-forum.com/t/date-select-year-as-a-text-field/192485/3 "2010-07-31T22:25:06Z")

</div>

Hi,

Seems the color highlighting plugin is broken in Safari.  
Please see it in FireFox.

regards,  
Sur  
[http://rubyonrailshacks.com](http://rubyonrailshacks.com)

Cam wrote:

> Thanks for your reply and for the tutorial. The code is not showing on  
> the page though.  
> [http://rubyonrailshacks.com/2010/07/how-to-modify-date\_select-to-show-text-field-for-year/](http://rubyonrailshacks.com/2010/07/how-to-modify-date_select-to-show-text-field-for-year/)
> 
> Cheers,
> 
> Cam

---

<div class="post-metadata">

**Author:** ![cam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/bbe5ce/32.png) [@cam](https://www.ruby-forum.com/u/cam)\
**Post date:** [July 31, 2010, 11:27pm UTC](https://www.ruby-forum.com/t/date-select-year-as-a-text-field/192485/4 "2010-07-31T23:27:30Z")

</div>

I see it now in Safari.  
Thanks again. The tutorial was very clear and straight forward. Worked  
very well.

Cam

---

<div class="post-metadata">

**Author:** ![cam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/bbe5ce/32.png) [@cam](https://www.ruby-forum.com/u/cam)\
**Post date:** [July 31, 2010, 10:17pm UTC](https://www.ruby-forum.com/t/date-select-year-as-a-text-field/192485/5 "2010-07-31T22:17:16Z")

</div>

Thanks for your reply and for the tutorial. The code is not showing on  
the page though.  
[http://rubyonrailshacks.com/2010/07/how-to-modify-date\_select-to-show-text-field-for-year/](http://rubyonrailshacks.com/2010/07/how-to-modify-date_select-to-show-text-field-for-year/)

Cheers,

Cam

---

<div class="post-metadata">

**Author:** ![cam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/bbe5ce/32.png) [@cam](https://www.ruby-forum.com/u/cam)\
**Post date:** [July 31, 2010, 11:32pm UTC](https://www.ruby-forum.com/t/date-select-year-as-a-text-field/192485/6 "2010-07-31T23:32:29Z")

</div>

Hi,

Yes, actually I had an exact requirement a while ago and when I saw you  
asking for the same thing, I thought it would be better to blog it down  
so it can be easily accessible for everyone.

regards,  
Sur  
[http://rubyonrailshacks.com](http://rubyonrailshacks.com)  
[http://expressica.com](http://expressica.com)

Sur M. wrote:

> Hi,
> 
> Seems the color highlighting plugin is broken in Safari.  
> Please see it in FireFox.
> 
> regards,  
> Sur  
> [http://rubyonrailshacks.com](http://rubyonrailshacks.com)
> 
> Cam wrote:
> 
> > Thanks for your reply and for the tutorial. The code is not showing on  
> > the page though.  
> > [http://rubyonrailshacks.com/2010/07/how-to-modify-date\_select-to-show-text-field-for-year/](http://rubyonrailshacks.com/2010/07/how-to-modify-date_select-to-show-text-field-for-year/)
> > 
> > Cheers,
> > 
> > Cam
