get loop values into controller from view

<%= form_tag({:action => ‘getrate’, :controller => ‘users’},{:method => :post}) do %>



<% @eachskill.each do |loc| %>

<%= submit_tag loc ,:type => “button”, :id => loc ,:disabled =>“disabled”, :class => “btn span2” %>

 

<%= select_tag( loc, “12345”.html_safe,:class => “span1”)%>


<% end %>

<%= submit_tag “Rate”, :class => “btn” %>

<% end %>

Here i need to get all the values from select_tag, into the controller,

amruby wrote in post #1065102:

<%= form_tag({:action => 'getrate', :controller => 'users'},{:method => :post}) do %>         <br><br>           *<% @eachskill.each do |loc| %>*             <%= submit_tag loc ,:type => "button", :id => loc ,:disabled =>"disabled", :class => "btn span2" %>             &nbsp;             <%= select_tag( loc,

"<option></option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option>".html_safe,:class

=> "span1")%>             <br>           *<% end %>*           <%= submit_tag "Rate", :class => "btn" %> <% end %>

Here i need to get all the values from select_tag, into the controller,

You are thinking backwards. Data should not flow from view to controller. It's the controller's job to provide that data to the view. Not the other way around.

            <%= select_tag( loc,

"<option></option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option>".html_safe,:class

=> "span1")%>

This list of options is data. Move this data out of the view. If this is simply a static list of options then you might simply put this into an instance variable in the controller. Then use the helpers provided by Rails to generate the HTML for the options list. Having to put that .html_safe directly into the view should be a trigger that you're doing something wrong.

See collection_select, options_from_collection_for_select or the other related helpers. There are enough of these helpers to cover just about any situation. I'm sure one of them will suit your needs.

In any case pushing data from view to controller is not the right solution.