Opened 19 years ago

Closed 18 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: dev
Severity: normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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

comment:1 by anonymous, 19 years ago

Type: defectenhancement

comment:2 by anonymous, 19 years ago

Component: Admin interfaceValidators

comment:3 by Jacob, 18 years ago

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?

by Steven Armstrong, 18 years ago

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

comment:4 by Chris Beaven, 18 years ago

Triage Stage: UnreviewedReady for checkin

comment:5 by Jacob, 18 years ago

Fixed in [4577]

comment:6 by Jacob, 18 years ago

Resolution: fixed
Status: assignedclosed

Grrr... fixing.

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