Topic: [SOLVED] How do I attach a CSS style to date_select?

Hello,

I have tried the following:

<%= f.date_select(:purchase_date, :use_short_month => 1, :order => [:month, :day, :year], :class => "gt-select-auto" ) %>

This works but the resulting HTML select code does not have the "gt-select-auto" class applied. What am I doing wrong?

The API indicates the following, but does not give any examples of applying a CSS style within the "html_options"

date_select(object_name, method, options = {}, html_options = {})

Thanks in advance.

PS - Originally posted this in the controller and view section, but thinking it probably belongs here, so posting again.

Last edited by tallp (2009-07-13 00:20:54)

Re: [SOLVED] How do I attach a CSS style to date_select?

Could you apply the styles using a surrounding <div>?

Re: [SOLVED] How do I attach a CSS style to date_select?

Perhaps. But the API for date_select seems to indicate there is a way to style it directly, and if that's the case, that's the method I would prefer. Thanks for the response.

Re: [SOLVED] How do I attach a CSS style to date_select?

Figured it out after some simple trial and error. For my original example, here is the tweaked code that applies a CSS style to a date_select:

<%= f.date_select(:purchase_date, {:use_short_month => 1, :order => [:month, :day, :year]}, {:class => "gt-select-auto"}) %>

Hope this helps someone