According to the docs for Form Helper's form_for
:
The form_for method automatically includes the model id as a hidden field in the form. This is used to maintain the correlation between the form data and its associated model. Some ORM systems do not use IDs on nested models so in this case you want to be able to disable the hidden id.
This makes sense and is important, but if you have two form_for
calls on the same page, it generates two hidden fields with the same markup and the same id. In my case, it generates this twice on the same page:
<input id="clinic_patient_signup_clinic_patient_link_person_attributes_patient_information_attributes_id" name="clinic_patient_signup[clinic_patient_link][person_attributes][patient_information_attributes][id]" type="hidden" value="32" /></div>
Is there a way to overwrite the id
attribute of that input? If I remember correctly, it's just the name
attribute that is important, and the value can stay the same. Our site has to be WCAG 2.0 accessibility compliant, and it won't allow two tags on the same page with the same id. (That's also not valid HTML.)