[patch] Error messages of RequiredIfOtherField* validators are not userfriendly
|Reported by:||Steven Armstrong||Owned by:||Jacob|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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.
RequiredIfOtherFieldEquals('action', 2, 'Forward Message to')
This is a backwards compatible change.
Change History (8)
comment:3 Changed 10 years ago by
|Owner:||changed from Adrian Holovaty to Jacob|
|Status:||new → assigned|
Changed 10 years ago by