how to get the value of date_select?

Dear All, <%= form_for(:crm_member_transactions, :url=>transaction_path                                         (:type=>type, :load=>1)) do |f| %>

From:<%= date_select :crm_member_transactions,:from,:start_year=>1980,:end_year=>1.year.from_now.year %>

To :<%= date_select :crm_member_transactions, :to, ,:start_year=>1980,:end_year=>1.year.from_now.year%>

Email:<%= f.text_field :email_addr%> <%= f.submit "Filter" %> <% end%>

i want to select the date then submit it to get the value of the seleted date,but when i get the value with params, it returns nil,these are the values i have submitted, {"crm_member_transactions"=>{"{:start_year=>1980, :end_year=>2013}(1i)"=>"2008", "{:start_year=>1980, :end_year=>2013}(2i)"=>"3", "{:start_year=>1980, :end_year=>2013}(3i)"=>"1", "to(1i)"=>"2011", "to(2i)"=>"12", "to(3i)"=>"1", "email_addr"=>""},

i can get the email value by params[:crm_member_transactions][:email_addr],but how can i get the date value?

Thanks

??any one can help me ?thanks

Hi!

Take a look at:

http://guides.rubyonrails.org/form_helpers.html#using-date-and-time-form-helpers

It seems that you’ve getting some problems with the “from” date_select, because you’re getting:

{"{:start_year=>1980,

:end_year=>2013}(1i)

"{:start_year=>1980, :end_year=>2013}(2i) "{:start_year=>1980,

:end_year=>2013}(3i)

but instead, you should get from(1i), from(2i) and from(3i).

It seems too that you have a extra comma here:

date_select :crm_member_transactions, :to, ,:start_year=>1980,:end_year=>1.year.from_now.year%>

In the end of the first line and the beginning of the second there are a comma. Maybe it’s a syntax error.

Later, you should use

params[:crm_member_transactions][:from]

and

params[:crm_member_transactions][:to]

to build the dates.

Sorry for my English mistakes. I’m not a native speaker.

Best Regards,

Everaldo