I'm using Rails 2.3.8. My code:
<%= f.radio_button :status, "draft" %>
<%= f.label :status, "Draft" %>
<%= f.radio_button :status, "published" %>
<%= f.label :status, "Published" %>
Output:
<input id="shop_status_draft" name="shop[status]" type="radio" value="draft" />
<label for="shop_status">Draft</label>
<input checked="checked" id="shop_status_published" name="shop[status]" type="radio" value="published" />
<label for="shop_status">Published</label>
Obviously the label
isn't associating with my radio buttons correctly. I want to make the label
same as radio button id
. How can I correct that?
Thanks.
Try this
<%= f.radio_button :status, "draft" %>
<%= f.label :status, "Draft", :value => "draft" %>
<%= f.radio_button :status, "published" %>
<%= f.label :status, "Published", :value => "published" %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With