Opened 9 years ago
Last modified 9 years ago
#27565 closed Bug
{{ form.as_p }} with RadioSelect generates invalid HTML — at Version 1
| Reported by: | Maciej Olko | Owned by: | nobody |
|---|---|---|---|
| Component: | Forms | Version: | 1.10 |
| Severity: | Normal | Keywords: | RadioSelect, invalid html, ul |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | yes |
Description (last modified by )
When working with forms, RadioSelect with {{ form.as_p }} renders to:
<p>
<label for="…">…</label>
<ul id="…>
<li><label for="…"><input id="…" name="…" type="radio" value="…" required /> …</label></li>
<li><label for="…"><input id="…" name="…" type="radio" value="…" required /> …</label></li>
…
</ul>
</p>
which is invalid. Vide http://stackoverflow.com/questions/10601345/ul-element-can-never-be-a-child-of-p-element .
It should render to:
<p>
<label for="…">…</label>
</p>
<ul id="…>
<li><label for="…"><input id="…" name="…" type="radio" value="…" required /> …</label></li>
<li><label for="…"><input id="…" name="…" type="radio" value="…" required /> …</label></li>
…
</ul>
Note:
See TracTickets
for help on using tickets.