﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
9153	Forms (and formsets) don't always generate valid HTML for hidden fields	Malcolm Tredinnick	nobody	"Creating a form with only hidden fields and than calling `as_p()` on it generates invalid (X)HTML. The input elements must reside inside certain block-level elements and this doesn't always happen. In r9067 I made a change that made this work when displaying error messages for such fields, but the general case is trickier.

The problem is that we can't just apply the same change as r9067 because that would introduce, for example, an empty table row in the `as_table()` method. This normally wouldn't be an issue (why, exactly, are you calling `as_p()` on a form that doesn't display anything?), but it arises fairly naturally with formsets. The management form for formsets is a form that only contains hidden fields. Thus, any formset display is slightly invalid. Fixing this doesn't appear to be entirely trivial, so I didn't drop in any kind of patch around the time of r9067.

There are some tests in `regressiontests/forms/forms.py` that actually demonstrate the problem here: except they consider the invalid output to be valid. So any patch fixing this will cause a couple of tests for hidden fields to ""fail"" and the tests will need to be fixed."	Bug	closed	Forms	1.0	Normal	needsinfo		asendecka@…	Accepted	0	0	0	0	0	0
