Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#12466 closed (fixed)

required class are also added to not required fields

Reported by: Bernd Schlapsi <brot@…> Owned by: Jannis Leidel
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Since [11830] there is the option to add css classes for errors and for required fields. But there is a error in the implementation. If you have a model with a few fields and there is a required field before a non required field the non required fields will also be given an "required" class.
This is a bug because the initialization of the variable which stores the classes is only initialize once before the for loop.

Attachments (3)

patch_css_classes.diff (749 bytes) - added by Bernd Schlapsi <brot@…> 7 years ago.
patch for this issue
patch_css_classes.2.diff (2.2 KB) - added by Bernd Schlapsi <brot@…> 7 years ago.
patch, now with a test
patch_css_classes.3.diff (2.7 KB) - added by Bernd Schlapsi <brot@…> 7 years ago.
patch with extended test

Download all attachments as: .zip

Change History (8)

Changed 7 years ago by Bernd Schlapsi <brot@…>

Attachment: patch_css_classes.diff added

patch for this issue

comment:1 Changed 7 years ago by Alex Gaynor

Needs tests: set
Triage Stage: UnreviewedAccepted

The patch looks correct to me, can you write up a simple test for this?

Changed 7 years ago by Bernd Schlapsi <brot@…>

Attachment: patch_css_classes.2.diff added

patch, now with a test

comment:2 Changed 7 years ago by Bernd Schlapsi <brot@…>

Needs tests: unset

Changed 7 years ago by Bernd Schlapsi <brot@…>

Attachment: patch_css_classes.3.diff added

patch with extended test

comment:3 Changed 7 years ago by Jannis Leidel

Owner: changed from nobody to Jannis Leidel
Status: newassigned

comment:4 Changed 7 years ago by Jannis Leidel

Resolution: fixed
Status: assignedclosed

(In [12153]) Fixed #12466 - Set HTML class attributes for each field separately. Thanks for the patch, Bernd Schlapsi.

comment:5 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top