Incorrect Min / Max plugin messages

Created on 24 May 2023, over 1 year ago
Updated 11 December 2023, 12 months ago

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'.

🐛 Bug report
Status

Needs work

Version

4.0

Component

Code

Created by

🇬🇧United Kingdom Rob Howells

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Rob Howells
  • Status changed to Needs review 12 months ago
  • 🇮🇳India nikunjkotecha India, Gujarat, Rajkot
  • Status changed to RTBC 12 months ago
  • 🇮🇳India Sandeep_k New Delhi

    Verified 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:

    1. Install the Clientside Validation module
    2. Go to Extend> Look for Clientside Validation module and install it.
    3. Go to Contact form, add number field
    4. Add min & max limit to the number field & verify validation message on the form
    5. Download this patch and Apply.
    6. Reverify the validation message on the contact form

    Testing Results:
    Validation messages are not changed.

    Moving this ticket to RTBC.

  • Status changed to Needs work 12 months ago
  • 🇮🇳India nikunjkotecha India, Gujarat, Rajkot

    Thanks Snadeep.

    We will need tests for this so moving to needs work.

Production build 0.71.5 2024