Opened 13 years ago

Closed 13 years ago

#17921 closed Uncategorized (wontfix)

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

Reported by: Haisheng HU 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 Haisheng HU 13 years ago.
add error_css_class and required_css_class to BaseForm's init method

Download all attachments as: .zip

Change History (2)

by Haisheng HU, 13 years ago

Attachment: base_form_css_class.diff added

add error_css_class and required_css_class to BaseForm's init method

comment:1 by Luke Plant, 13 years ago

Resolution: wontfix
Status: newclosed

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