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

Refactor RequiredField validator #10467

Closed
maxime-rainville opened this issue Aug 24, 2022 · 2 comments
Closed

Refactor RequiredField validator #10467

maxime-rainville opened this issue Aug 24, 2022 · 2 comments

Comments

@maxime-rainville
Copy link
Contributor

The current behaviour for RequiredFields is weird. It runs the individual validation for each field which seems like mixed concerns.

It also happily accepts a white space has a non-empty string.

@GuySartorelli
Copy link
Member

GuySartorelli commented Aug 29, 2022

IMO this should be split into two separate validators - one for the required fields validation and another entirely separate validator for calling validate() on each field.
The latter of these could by default be included in scaffolded composite validators (e.g. on CMS edit forms).
We've implemented that.

As for the whitespace we should make it not accept white-space as a "value" (i.e. if the value is only whitespace for a required field, throw a validation error) - but perhaps add a configuration option to allow it, in case someone has some valid use-case for whitespace-only values.

@GuySartorelli
Copy link
Member

Closing as a duplicate of #10908

@GuySartorelli GuySartorelli closed this as not planned Won't fix, can't repro, duplicate, stale Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants