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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joelpittet’s picture

This seems almost like a bug. The code does check for 'any' but there is no way to configure this value as you mentioned.

NickDickinsonWilde’s picture

Status: Active » Needs review
FileSize
1.8 KB

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