Opened 7 years ago

Last modified 7 years ago

#27565 closed Bug

{{ form.as_p }} with RadioSelect generates invalid HTML — at Initial Version

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

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 totally 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 (0)

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