Because of some third party dependencies I''m trying to use a
date_select helper (actually datetime, but they behave the same)
whilst specifying an ID for each of the three selectors (day/month/
year).
<%= f.date_select :start, {:order => [:day, :month, :year]}, {:id =>
{:year => ''abc'', :month => ''de'', :day
=> ''xy''}} %>
The code above nearly works; the right selectors are generated in the
right order, however, the IDs of each selector are the same; simply a
flattened down version ''monthdeyearabcdayxy'', using an array
has the
same effect.
How can I achieve this while still having Rails handle most of the
work?
Frederick Cheung
2009-Aug-08 21:59 UTC
Re: Date_select - Specifying an id for each selector fails
On Aug 8, 9:41 pm, Lb2007 <yor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> <%= f.date_select :start, {:order => [:day, :month, :year]}, {:id => > {:year => ''abc'', :month => ''de'', :day => ''xy''}} %> > The code above nearly works; the right selectors are generated in the > right order, however, the IDs of each selector are the same; simply a > flattened down version ''monthdeyearabcdayxy'', using an array has the > same effect. > > How can I achieve this while still having Rails handle most of the > work?Your best bet is probably to call the individual helpers for each component (select_hour etc...). Look at the output of date_select to see what names you should use for the inputs. Fred