How to add radio buttons?

Hello friends,

Can u plz tell me how we can add radio buttons in the view?

Hello,

Rails provides view helpers for creating such input fields

following helper method creates radio button

radio_button(object_name, method, tag_value, options = {})

for more information look at rails helper API doc at

http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#M001613

Regards,
Narendra

Hi,

<%= radio_button :contact_preference, “0”, :checked =>
true, :tabindex => “1” %>Email
<%= radio_button :contact_preference, “1”, :checked =>
false, :tabindex => “2” %>Phone

something like this will do.

Thanks
Amal

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