radio_button not updating the database

Hi,
Am creating a survey, in which am getting the questions from question
table and answers from answers table.
In the survey table am displaying the questions with the answers as
multiple choice using radio buttons.
Also while selcting the option the vote_count should be increased.

The front end part is working correctly, it shows as per my requirement.
but no values are updated in the database.

<%=radio_button(:nominees, count, :onclick =>
@voting.increment!('vote_count') ) %> <%= response.nomination %>
i want to store the selected values in nominees attribute and want to
increase the vote_count by selecting the option.
any help or advice reg this would be very helpful.

Tamilselvi Srinivasan wrote:

Hi,
Am creating a survey, in which am getting the questions from question
table and answers from answers table.
In the survey table am displaying the questions with the answers as
multiple choice using radio buttons.
Also while selcting the option the vote_count should be increased.

The front end part is working correctly, it shows as per my requirement.
but no values are updated in the database.

<%=radio_button(:nominees, count, :onclick =>
@voting.increment!('vote_count') ) %> <%= response.nomination %>
i want to store the selected values in nominees attribute and want to
increase the vote_count by selecting the option.
any help or advice reg this would be very helpful.

Keep a default value in the answer table for this particular field
instead of keeping it NULL

Kannan
http://www.classifieds.org.in

Tamilselvi Srinivasan wrote:

Tried with that, no change.

Keep a default value in the answer table for this particular field
instead of keeping it NULL

Kannan
http://www.classifieds.org.in

<%= radio_button yourmodel, model-attribute, value, :onclick=>something
%>

Thanks for the quick reply,
Am getting the radio button options from answers table. also its a group
of radio buttons.
so the count means for the radio_button id. if i change the count as
follows

<%=radio_button(:survey, :nominees, count, :onclick =>
@voting.increment!('vote_count') ) %> <%= response.nomination %>

the onclick option needs to be a fragment of javascript. Right now you
are calling @voting.increment! at the point that the template is
rendered.

Fred