Opened 8 years ago

Closed 8 years ago

#27565 closed Bug (duplicate)

{{ form.as_p }} with RadioSelect generates invalid HTML

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 Maciej Olko)

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>

Change History (2)

comment:1 by Maciej Olko, 8 years ago

Description: modified (diff)

comment:2 by Tim Graham, 8 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #6388 (wontfix) and #22333 (duplicate).

Note: See TracTickets for help on using tickets.
Back to Top