Vote count:
1
I have a similar question to this but I can't figure out how to do it in HAML.
My code is, at the moment:
.col-sm-10.radio-toolbar
- YearGroup.all.each do |year_group|
= f.label dom_id(year_group), year_group.name
= f.radio_button :year_group_id, year_group.name
Which gives me, in html:
<div class="col-sm-10 radio-toolbar">
<label for="test_year_group_1"></label>
<input id="test_year_group_id_as" type="radio" name="test[year_group_id]" value="AS"></input>
<label for="test_year_group_2"></label>
<input id="test_year_group_id_a2" type="radio" name="test[year_group_id]" value="A2"></input>
</div>
As you can see, the label for has a number, whereas the input id has as or a2. How can I add a value to the label so that it will be the same as the id on the input?
asked 1 min ago
Associating label and radio button in HAML
Aucun commentaire:
Enregistrer un commentaire