Add "required" & "error" CSS classes to form rows in as_* methods
|Reported by:||Owned by:||nobody|
|Cc:||waylan@…, real.human@…, Gonzalo Saavedra, liangent@…, andy@…, drackett@…||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||no||Patch needs improvement:||no|
Currently, there is no way to identify which fields have errors or are required with CSS. The patch below adds HTML classes to the containing block element for that purpose.
Therefore, using as_tr(), a field that is both required and contains an error would begin like so:
<tr class="error required">...
I have submitted three patches for consideration as I am unsure of whether we want to to allow people creating their own as_methods (through subclassing etc) to be able to add their own classes separate from the above.
See this thread for more details: http://groups.google.com/group/django-developers/browse_thread/thread/fbd0c8cfbf1b819b/
The three patches do not yet have tests (or at least the existing tests have not been adjusted) and I haven't even looked at docs. Maybe when a decision is made, I'll tackle that. Or if anyone else wants to...
Change History (46)
comment:23 Changed 9 years ago by
|Patch needs improvement:||set|
|Status:||closed → reopened|
|Summary:||[patch] Add HTML classes to fields in newforms as_methods: "required" & "error" → [patch] Add "required" & "error" CSS classes to form rows in as_* methods|
comment:29 Changed 9 years ago by
|Summary:||[patch] Add "required" & "error" CSS classes to form rows in as_* methods → Add "required" & "error" CSS classes to form rows in as_* methods|
|Triage Stage:||Design decision needed → Accepted|