Problem/Motivation
When a field has the `min` and/or `max` attributes set, the validation message is incorrect.
Example
If a field has the following attributes:
'#min' => 1,
'#max' => 10,
On the front end, if a number less than 1 is entered, the error message that is currently displayed is:
The value in @field has to be greater than 1.
If a number greater than 10 is entered, the error message that is currently displayed is:
The value in @field has to be less than 1.
Although both 1 and 10 are both valid entries, the messaging informs the user that they must enter something greater or less than those amounts.
Proposed resolution
Instead of the error messages being 'greater than' or 'less than', they should be changed to 'greater than or equal to' and 'less than or equal to'.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | After Patch 2.png | 44.13 KB | sandeep_k |
| #4 | After Patch 1.png | 44.63 KB | sandeep_k |
| #4 | Before Patch.png | 61.83 KB | sandeep_k |
| #2 | 3362408-min-max-messages.patch | 1.24 KB | rob howells |
Comments
Comment #2
rob howells commentedComment #3
nikunjkotechaComment #4
sandeep_k commentedVerified and tested patch 3362408-min-max-messages.patch on the Drupal version- 9.5.12-dev. The patch was applied successfully and looks good to me.
Testing Steps:
Testing Results:
Validation messages are not changed.
Moving this ticket to RTBC.
Comment #5
nikunjkotechaThanks Snadeep.
We will need tests for this so moving to needs work.