Forum: Ruby on Rails date helpers --> where art thou, html_options?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
21748a8f5ece5209b1ab67b28cda46c2?d=identicon&s=25 Tieg Infosauce (coldcrush)
on 2005-12-13 20:31
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
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2005-12-14 02:07
(Received via mailing list)
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.
This topic is locked and can not be replied to.