Skip to content

Default rules showing incorrect validation #32

@alsoto25

Description

@alsoto25

Prerequisites

  • I have searched for duplicate or closed issues

Describe the issue

The rules EmptyOrLetters, NoEmptySpacesOnly, MinCharacterAmount and CharacterAmount have validation functions that show incorrect results or have unexpected results.

  • EmptyOrLetters: An input like John123 passes the validation even with numbers in it.
  • NoEmptySpacesOnly: The Validator passes the input through the String.trim() function which means this rule always returns true
  • MinCharacterAmount: If a field doesn't have the required rule, passing an empty value on a field with a rule like minCharacterAmount(3) show the field as valid
  • CharacterAmount: Same case as MinCharacterAmount

Steps to Reproduce

  1. Initialize form validation with any of the rules
  2. Fill input with respective cases noted in description
  3. See error

Expected Behavior

  • EmptyOrLetters: Either change the name of the rule to something less misleading like atLeastOneLetter or change the validation of this rule.
  • NoEmptySpacesOnly: The rule should be removed or the validator options should allow a flag to know if .trim() should be used by default on values or not.
  • MinCharacterAmount: I think this is working as expected, but we should be clear with how this behavior
  • CharacterAmount: Same case as MinCharacterAmount

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

Other, Chrome, Safari, Firefox, Microsoft Edge, Opera

Other browser(s)

No response

What version of the browser are you using?

Chrome

Where does the bug occur?

Desktop

Form setup and validation rules

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions