Hello i have a lot of time trying to figure this out.
I am having problem sending array params with form_tag :remote=>true
form.erb
<%#= form_tag reporte_client_reports_path do%>
<%= form_tag reporte_client_reports_path,:remote=>true do%>
<p>
<%= label_tag :cuts %>
<%= select_tag "cuts[]",
options_from_collection_for_select(@cuts,
"real_cut", "cut"), :multiple=>true, :id =>
"cuts"%>
</p>
<p>
<%= submit_tag ''Send'' %>
</p>
<%end%>
Controller
def report
@cuts = params[:cuts]
respond_to do |format|
format.html {render :layout => false if request.xhr?}
format.js #{render :layout => false}
end
end
Results
debug results:
- 2011-02-15,2011-02-28,2011-03-15,2011-03-31
It work if i use
<%= form_tag reporte_client_reports_path do%>
debug results:
---
- "2011-02-15"
- "2011-02-28"
- "2011-03-15"
- "2011-03-31"
The problem is in remote the form pass the parameters not as a array :s
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Edgar Gonzalez
2011-May-05 06:34 UTC
Re: form_tag :remote=>true not passing params as Array
I resolved in functional way, but there might be something very weird
with this in my controller:
if request.xhr?
@super = params[:supermercados].to_s.split(",")
@cortess = params[:cortes].to_s.split(",")
@prods = params[:productos].to_s.split(",")
end
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.