Radio Button Question

Hi all,

I’m a new Ruby on Rails user, and I’m trying to make a page with
several groups of 3 radio buttons. The user chooses one button from
each group, then clicks the save button, where each selection is
stored in the database. My question is how I can know which button was
selected - is there a method like get_checked_button, or do I have to
cycle through each group and see which of the three is checked? If the
latter is the case, how would I do that?

Thanks!

-Kevin

Hi Kevin,

actually I do this with javascript and a snippet of ruby
may somebody know a better way to do this.

regards

Rafael


case params[:apply_as]
when “spontanous”
@apply_as_spontanous = ‘checked’
when “specific”
@apply_as_specific = ‘checked’
else
@apply_as_specific = ‘checked’
end


<input type=“radio” name=“apply_as” id=“apply_as” value=“spontanous” <
%= “#{@apply_as_spontanous}” %> /> Spontanbewerbung
<input type=“radio” name=“apply_as” id=“apply_as” value=“specific” <
%= “#{@apply_as_specific}” %> /> Bewerbung auf Offene Vakanz