I have a survey taking page with a set of questions. Each question has
five radio buttons. After answering the questions user clicks submit.
Then based on the selection the values must be updated in the table
called results.

Each row in the results table represents a unique radio button.

the code is here
All the radio buttons each having unique result id are being passes in
results.ids[]
But I want only the selected ones.
I am new to ruby on rails..can you please help me out?


<% if @questions.size>0 %>

  <% form_tag :action => 'results_update', :method => :put do %>

  <% for @q in @questions %>
  <%= "Q.#{@q.text}"%>
  <br />
  <% @results = Results.where(:Questions_id => @q.id) %>
    <% for r in @results %>
         <%= radio_button_tag @q.id, 'results.ids[]',r.id%>
         <%=h r.id%>
         <br />
      <% end %>
    <br />
    <%end%>
  <p><%= submit_tag "Submit" %></p>
    </table>
     <% end %>
 <% else%>

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

Reply via email to