Opened 9 years ago

Closed 8 years ago

#2014 closed enhancement (fixed)

[patch] Error messages of RequiredIfOtherField* validators are not userfriendly

Reported by: Steven Armstrong Owned by: jacob
Component: Validators Version: master
Severity: normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When working with RequiredIfOtherFieldEquals and RequiredIfOtherFieldDoesNotEqual validators the error messages can be quite user unfriendly.

Assuming you have a select-box named 'action' where the currently selected option has a value of 2 and a label of 'Forward Message to' you get error messages like:
This field must be given if action is 2

That sort of let's the user sit there feeling dumb. 2, where does that 2 come from and what does it mean ???

With the attached patch applied you can have error messages like:
This field must be given if action is Forward Message to

The label is passed as a third, optional, argument to the validators constructor.

e.g.:
RequiredIfOtherFieldEquals('action', 2)

becomes:
RequiredIfOtherFieldEquals('action', 2, 'Forward Message to')

This is a backwards compatible change.

Attachments (2)

required-if-other_label-insteadof-value.patch (2.0 KB) - added by anonymous 9 years ago.
required-if-other_label-insteadof-value_with-docs.diff (2.4 KB) - added by Steven Armstrong 9 years ago.
Patch with docs. You might want to check the docs and rephrase if necessary. English is not my native tounge.

Download all attachments as: .zip

Change History (8)

Changed 9 years ago by anonymous

comment:1 Changed 9 years ago by anonymous

  • Type changed from defect to enhancement

comment:2 Changed 9 years ago by anonymous

  • Component changed from Admin interface to Validators

comment:3 Changed 9 years ago by jacob

  • Owner changed from adrian to jacob
  • Status changed from new to assigned

Great addition!

It needs docs (in forms.txt); can you add 'em so I can check this in?

Changed 9 years ago by Steven Armstrong

Patch with docs. You might want to check the docs and rephrase if necessary. English is not my native tounge.

comment:4 Changed 8 years ago by SmileyChris

  • Triage Stage changed from Unreviewed to Ready for checkin

comment:5 Changed 8 years ago by jacob

Fixed in [4577]

comment:6 Changed 8 years ago by jacob

  • Resolution set to fixed
  • Status changed from assigned to closed

Grrr... fixing.

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