<%= 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 received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/KaFYFB-MJpEJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Robert Walker at Jun 19, 2012 at 3:05 pm

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJun 19, '12 at 10:06a
activeJun 19, '12 at 3:05p
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Robert Walker: 1 post Amruby: 1 post

People

Translate

site design / logo © 2021 Grokbase