Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Originally reported by luison99 on #1541838: Update number element to match what is not in 8.x core., default numberfields don't allow decimal numbers.
I had to go to elements_validate_number() to find out that '#step' needs to be 'any' for this to work, but elements_element_info() sets '#step' to 1 by default. This is unintuitive, and probably ought to be documented better.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2287251-numberfield-documentation-2.patch | 1.8 KB | NickDickinsonWilde |
Comments
Comment #1
joelpittetThis seems almost like a bug. The code does check for 'any' but there is no way to configure this value as you mentioned.
Comment #2
NickDickinsonWildeAs per MDN Allowing Decimal Values, the front end validation requires step values to be set to allow decimal values to pass browser validation. The backend check in
elements_valid_number_step()
works effectively identically.Attached, patch with updated readme.