Ruby on Rails field_for Form Helper Problems
- by schone
Hi all,
I'm using the field_for form helper with a loop:
<% f.fields_for :permissions do |permission_form| %>
<tr>
<td><%= permission_form.object.security_module.name %><%= permission_form.hidden_field(:security_module_id) %></td>
<td><%= permission_form.object.security_module.description %></td>
<tr>
<% end %>
The resulting output of the above code is this:
<input id="role_permissions_attributes_0_id" name="role[permissions_attributes][0][id]" type="hidden" value="76" />
<tr>
<td>Diary<input id="role_permissions_attributes_0_security_module_id" name="role[permissions_attributes][0][security_module_id]" type="hidden" value="13" /></td>
<td>Access to the Diary Module</td>
</tr>
<!-- next input field then <tr> tag -->
The problem with this markup is that the input tag falls outside of the tr tag which there for causes validation issues with XHTML.
Does anyone know how I can have the input tag fall inside the tr tag therefore giving me valid XHTML 1.0 STRICT markup?
Thanks