date_select Year as a text_field

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

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/

regards, Sur 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/

Cheers,

Cam

Hi,

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

regards, Sur http://rubyonrailshacks.com

Cam wrote:

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

Cam

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://expressica.com

Sur Max wrote: