Radio_button_tag and id

One more question (there’s ALWAYS one more )

When a radio button tag is used, the id is taken from the name. However,
if you have 5 radio buttons in a group, they all have the same name -
therefore the same id. Among other things (id is only supposed to happen
once), this seems to preclude the use of a tag for the radio
buttons.

Obviously, there has to be some way around this. What’s the syntax for
specifying a unique id for the radio_button_tag (and the radio_button
for that matter)

As always, thanks in advance

Michael S. wrote:

One more question (there’s ALWAYS one more )

When a radio button tag is used, the id is taken from the name. However,
if you have 5 radio buttons in a group, they all have the same name -
therefore the same id. Among other things (id is only supposed to happen
once), this seems to preclude the use of a tag for the radio
buttons.

Obviously, there has to be some way around this. What’s the syntax for
specifying a unique id for the radio_button_tag (and the radio_button
for that matter)

As always, thanks in advance

I do it like this…
<%= radio_button_tag(‘free’, ‘true’, true, :id =>
‘free_radio’) %> 
I want it for FREE (I’m a
cheepskate)
<%= radio_button_tag(‘free’, ‘false’, false, :id =>
‘not_free_radio’) %> 
I’m willing to pay this
much:

best,
jp

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs