Hi there!
I m using this form:
<%= form_for(:usage, :url=> {:action =>'getResults'}) do |f| %>
<legend>Select search criteria : </legend>
<%= f.radio_button :filter, 'uni'%> <span style="font-size:15px;">For
Unicast only</span>
<br>
<%= f.radio_button :filter, 'multi' %> <span
style="font-size:15px;">For Multicasts only</span>
<br>
<%= f.radio_button :filter, 'month' %> <span
style="font-size:15px;">Current Month</span>
<br>
<%= f.radio_button :filter, 'date' %> <span style="font-size:15px;">On
this date:
<br><br>
<%= f.date_select(:date,:order=>[:day,:month,:year])%>
<br>
<%= link_to 'Search', {:action=>"getResults"}, :remote => true,
:submit%>
<% end %>
and in controller I have:
def getResults
if params[:filter] == 'uni'
@results = Multicasts.where(:sms_voice => 'sms')
end
if params[:filter] =='multi'
@results = Multicasts.where(:when => 'im')
end
if params[:filter] =='month'
@results = Multicasts.where('extract(month from datetime) = ?',
MONTH(date))
end
render :new_results
end
Is this a correct way to read info from radio buttons.
Please help, it is not working. Is the syntax correct?
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/164cb230-e42a-4f9a-a02b-d83a0aa71111%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.