Validate the min, max and default values for Numeric fields

Created on 4 May 2019, over 5 years ago
Updated 28 October 2023, about 1 year ago

Problem/Motivation

Max value can be less than min value for NumericItems.

(Ps. I find it a bit surprising how such an obvious bug could slip through, so I searched the Core number.module's issue queue before opening this thread.)

Steps to reproduce

Tested scenarios:

  1. Field type: Number (decimal)
    On these paths of entities:
    • Node: /admin/structure/types/manage/page/fields/node.page.field_number_decimal/storage
    • Taxonomy: /admin/structure/taxonomy/manage/forums/overview/fields/taxonomy_term.forums.field_number_decimal
    • User: /admin/config/people/accounts/fields/user.user.field_number_decimal
  2. Field type: Number (float)
    On these paths of entities:
    • Node: /admin/structure/types/manage/page/fields/node.page.field_number_float
    • Taxonomy: /admin/structure/taxonomy/manage/forums/overview/fields/taxonomy_term.forums.field_number_float
    • User: /admin/config/people/accounts/fields/user.user.field_number_float
  3. Field type: Number (integer)
    On these paths of entities:
    • Node: /admin/structure/types/manage/page/fields/node.page.field_number_integer
    • Taxonomy: /admin/structure/taxonomy/manage/forums/overview/fields/taxonomy_term.forums.field_number_integer
    • User: /admin/config/people/accounts/fields/user.user.field_number_integer

Test settings:

  • Min = 4
  • Max = -4
  • Default = 2

Test results:

  • Expected: form validation should deny submitted values
  • Result: settings saved into DB.

Proposed resolution

Add tests of min and max value.

Remaining tasks

Start with the patches from the duplicate issue;

Add tests
patch
review
commit

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Fixed

Version

10.2

Component
Field 

Last updated 2 days ago

Created by

🇭🇺Hungary Balu Ertl Budapest 🇪🇺

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024