Ruby on Rails field_for Form Helper Problems

Posted by schone on Stack Overflow See other posts from Stack Overflow or by schone
Published on 2009-08-06T00:30:07Z Indexed on 2010/03/30 0:03 UTC
Read the original article Hit count: 342

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about XHTML