Decimal rule doesn't work properly:

  • Integers aren't allowed
  • Negative values aren't allowed
  • Why use a regex and not php's filter_var()?

Comments

ss81’s picture

StatusFileSize
new431 bytes
spadxiii’s picture

Status: Needs review » Needs work

This rule also doesn't accept a single digit. Which is still a valid number.

Does a decimal require a decimal separator and decimals or can integers be valid as well?

Side note: in different areas in the world, a comma is used as decimal separator. The validation also doesn't account for that.
Side note 2: perhaps use the php function filter_var (with FILTER_VALIDATE_FLOAT) instead of a regex?

spadxiii’s picture

Issue summary: View changes

Just had a thought that "1.2.3" is not a valid decimal. Updating this issue to make it more general for the decimal-rule.

pedrofaria’s picture

Your suggestion was ported to version 8. thanks

  • pedrofaria committed 772947f on 8.x-2.x
    Issue #2320453 by ss81: Decimal rule doens't work correctly
    
astonvictor’s picture

Since, it's committed then we can close it.

astonvictor’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.