views:

68

answers:

2

hi, i want to use radio buttons for survey. ex: Best Article Award Tamil Monica Best Article on Travelogue Award Tamil Selvi ...

the answers will be the radio button.. am implementing this as follows <%=radio_button(count, :voting, :nominees ) %> <%= response.nomination %>

where count is the id of radio button voting -- model name nominees -- attribute name response.nomination -- option value

this gives the above result.. but the selected values are not updating in the nominees field.. can anyone tell were am wrong..

A: 

use like this

<%=radio_button(count, :voting, @response.nomination)%>

and what does :nominees you have used

Senthil Kumar Bhaskaran
Actually i want to store the selected values in nominees field.(its a attribute in voting model)..Also am getting the option values from reponse table.( response.nomination )
sts
+1  A: 

Ok then try this

<%=radio_button(:voting, :nominees, :id=>count, :value=>response.nomination)%>
Senthil Kumar Bhaskaran
<% count = 1 %><% for question in @questions %><%=count%>. <%= question.title if question.title%> <% for response in @response %> <% if response.question_id.eql?(question.id) %> <%=radio_button(count, :voting, :nominees) %> <%= response.nomination %> <% end %> <% end %> <% count += 1 %> <% end %> This is my whole code to implment the survey. if i give the count as third argument in radio button i cant select answer for each question. i can select only one answer for the whole survey.
sts
Also if i give the value inside radio_button, no values are displayed
sts