Opened 3 years ago

Closed 3 years ago

#17921 closed Uncategorized (wontfix)

Add default "error" and "required" css classes to form rows

Reported by: hanson2010 Owned by: nobody
Component: Forms Version: 1.3
Severity: Normal Keywords:
Cc: hanson2010@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description

Ticket #3512 talked about this feature a few years ago. User can now add error_css_class and required_css_class to its own Form/ModelForm subclass. But it should be more convenient/straightforward to have these attributes assigned in its parent BaseForm.

The default output of a required/error row will be as follows.

<tr class="required error">
<th><label for="id_name">Name:</label></th>
<td>
<ul class="errorlist"><li>This field is required.</li></ul>
<input id="id_name" type="text" name="name" maxlength="256" />
</td>
</tr>

Attachments (1)

base_form_css_class.diff (1.1 KB) - added by hanson2010 3 years ago.
add error_css_class and required_css_class to BaseForm's init method

Download all attachments as: .zip

Change History (2)

Changed 3 years ago by hanson2010

add error_css_class and required_css_class to BaseForm's init method

comment:1 Changed 3 years ago by lukeplant

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

I'm going to WONTFIX, because:

  1. this isn't a very common need, and you can already achieve what you need by subclassing.
  1. there are no other HTML-related attributes passed to __init__. It doesn't make sense to complicate the constructor of Form for this requirement.
Note: See TracTickets for help on using tickets.
Back to Top