Code

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#3101 closed defect (fixed)

newforms produces invalid XHTML with hidden fields

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

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.

Attachments (0)

Change History (3)

comment:1 Changed 8 years ago by adrian

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 Changed 8 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:3 Changed 8 years ago by adrian

(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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.