Vee-validate: Numeric validation does not allow negative numbers

Created on 3 May 2018  路  3Comments  路  Source: logaretm/vee-validate

Versions:

  • VueJs: #.#.#
  • Vee-Validate: #.#.#

Description:

Any attempt to use a negative number will fail if using the numeric validation rule.

Steps To Reproduce:

Go to https://baianat.github.io/vee-validate/guide/rules.html#numeric and enter "-1"

All 3 comments

Numeric rule means that the input can only consist of numbers but doesn't
take into account that the input sign. There's another rule for that, like
integer.

@logaretm
Then it's not numeric validation, merely character validation. Either it should take into account the '-' sign or the validation rule is not correctly named. Your suggestion of 'integer' would not be an appropriate choice either as -1.234 should pass being evaluated as 'numeric' but fail 'integer'.

@MeltedFreddo "-1.234" can be validated by the "decimal" rule. I agree the name for "numeric" is slightly misleading, but "digits" already serves another purpose, and "integer" and "decimal" support signed numbers.

Was this page helpful?
0 / 5 - 0 ratings