Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#3101 closed defect (fixed)

newforms produces invalid XHTML with hidden fields

Reported by: Eric <cephelo@…> Owned by: Adrian Holovaty
Component: Forms Version: dev
Severity: minor Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Based on the unit tests around line 1769 in source:/django/trunk/tests/regressiontests/forms/tests.py Django's newforms produce invalid XHTML.

The only elements allowed under a <table> tag are <thead>, <tbody>, and <tr>.

I am unsure of a concrete solution to this. If the hidden field isn't the last field, rendering can be delayed until the next rendered <td> tag (the next label). In the case that the hidden fields are last, perhaps insert them at the end of the last <td> rendered or render an empty row, although that is less-than-ideal.

Change History (3)

comment:1 by Adrian Holovaty, 18 years ago

Good catch. I'd assumed it would be valid XHTML, but I guess not. :-/

I guess rendering could either be delayed for the next <td>, or we could save all the hidden fields and render them all together at the bottom of the form. Hmm...

comment:2 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

(In [4175]) Fixed #3101 -- newforms: Form.as_table() no longer puts hidden fields between <tr>s. Thanks for reporting, Eric

comment:3 by Adrian Holovaty, 18 years ago

(In [4177]) newforms: Form.as_ul() no longer puts hidden fields between <li>s. Similar to [4175], which was the same thing for Form.as_table(). Refs #3101

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