#9153: Forms (and formsets) don't always generate valid HTML for hidden fields -------------------------+-------------------------------------------------- Reporter: mtredinnick | Owner: nobody Status: new | Milestone: Component: Forms | Version: 1.0 Keywords: | Stage: Unreviewed Has_patch: 0 | -------------------------+-------------------------------------------------- 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. -- Ticket URL: <http://code.djangoproject.com/ticket/9153> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---
