Date helpers --> where art thou, html_options?


#1

Hi railsians, just wondering if anyone has any info on passing
html_options to date helpers?

My problem is that I need to do a select_month, but I need to pass an ID
attribute to the HTML and there are no html_options for those helpers
apparently. The reason why I need to pass the ID is to access it in JS,
and I can’t because of the name of the select is for the hash (ie
“date[month]”), which means it has brackets (my JS skills are rusty,
maybe there’s a way to access it even with that name?

thx


#2

tieg infosauce wrote:

Hi railsians, just wondering if anyone has any info on passing
html_options to date helpers?

My problem is that I need to do a select_month, but I need to pass an ID
attribute to the HTML and there are no html_options for those helpers
apparently. The reason why I need to pass the ID is to access it in JS,
and I can’t because of the name of the select is for the hash (ie
“date[month]”), which means it has brackets (my JS skills are rusty,
maybe there’s a way to access it even with that name?

You may be able to use document.getElementsByName(‘date[month]’).

I found three pending patches for adding id attributes to date helpers:

http://dev.rubyonrails.org/ticket/1050
http://dev.rubyonrails.org/ticket/1382
http://dev.rubyonrails.org/ticket/2655


We develop, watch us RoR, in numbers too big to ignore.