Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 'required' rule to prohibit blank spaces #104

Conversation

gcatala-cr
Copy link

Bug:
On a required field, entering ONLY a space(space or tab) is accepted as a valid value.
On our end we had to override the required rule with a regex test to prohibit lone spaces from passing validation.

Replicated on multiple browsers.
Tested on Google Chrome Version 74.0.3729.169 (Official Build) (64-bit)
Mac OS Mojave Version 10.14.5 (18F132)

Bug is reproducible on working example from Git page:
https://dockwa.github.io/simple-react-validator/index.html

Update:
On 'required' rule, updated this:
this.helpers.isBlank(val)
to a regex that makes sure the value is NOT a blank space(tab, space, etc):
this.helpers.testRegex(val, /[^\s]/)

On 'required' rule, updated this:
this.helpers.isBlank(val)
to a regex that makes sure the value is NOT a blank space(tab, space, etc):
this.helpers.testRegex(val, /[^\s]/)
@stuyam
Copy link
Collaborator

stuyam commented Jun 19, 2019

@gcatala-cr seems like the implementation of the isBlank method should take into account spaces and then just continue to use isBlank everywhere.

@gcatala-cr
Copy link
Author

Yea, that makes sense.

@stuyam stuyam self-assigned this Jul 8, 2019
@stuyam
Copy link
Collaborator

stuyam commented Jul 29, 2019

@stuyam stuyam closed this Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants