Default date for date_select

Hi,

How can I set a default date for a date_select?

I’m trying to do something along the lines of:

<%= date_select(“requirement”, “target_date”, :end_year =>
2020, :discard_day => true, :include_blank => true, :order =>
[:month, :year], :default => {:month => 10, :year => 2012 }) %>

but the default that comes up on the form is blank month and blank
year.

Thanks,
Tony

Did you try to remove

:include_blank => true

I did try that. It defaults to the current month and year instead of
what I specified.

On Oct 13, 7:32 am, Jamal S. [email protected]

Hi All

I’m having a similar issue with the following which defaults to
today’s date rather than specified default.

<%= date_select(:search, :start, :order =>
[:day, :month, :year], :default => “2007-06-24”) %>

Any ideas?

Cheers
Adrian

What version of rails are you using? The default option for
date_select only works in edge rails.

randomutterings… wrote:

What version of rails are you using? The default option for
date_select only works in edge rails.

well, i’m using rails 1.2.5 and the default date_select still without
work…

any idea how to fix it!!! appreciate your help

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs