Forum: Ruby on Rails Radio buttons are not mutually exclusive in Edit page

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bb9f5f2778b04aa3e142b8e1502624a6?d=identicon&s=25 Satya Prusty (satya75)
on 2008-11-21 08:29
I have two emails for a contact. The first email is primary.While saving
a new contact I can only set one radio button for primary, but in edit
page the primary radio button can be set for both emails(not mutually
exclusive)


View
<tr>
   <% for email in @contact.emails %>
   <% fields_for "contact[email_attributes][]", email do |e| %>
   <td nowrap class="formLabel">Email </td>
   <td > <%= e.select ('email_type',%w{Business Personal},
:include_blank => false) %>
   <%= e.text_field :email,:size=>"35",:maxlength=>"80" %>
   <%= e.radio_button ('isprimary', 'true') %>Primary
   </td>
 </tr>
 <% end %>
 <% end %>
</table>
This topic is locked and can not be replied to.