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.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to