Opened 11 years ago

Closed 10 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 11 years ago.
required-if-other_label-insteadof-value_with-docs.diff (2.4 KB) - added by Steven Armstrong 10 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 11 years ago by anonymous

comment:1 Changed 11 years ago by anonymous

Type: defectenhancement

comment:2 Changed 11 years ago by anonymous

Component: Admin interfaceValidators

comment:3 Changed 10 years ago by Jacob

Owner: changed from Adrian Holovaty to Jacob
Status: newassigned

Great addition!

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

Changed 10 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 10 years ago by Chris Beaven

Triage Stage: UnreviewedReady for checkin

comment:5 Changed 10 years ago by Jacob

Fixed in [4577]

comment:6 Changed 10 years ago by Jacob

Resolution: fixed
Status: assignedclosed

Grrr... fixing.

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