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

Trim option on the Length validator #3366

Open
SkwalExe opened this issue Sep 21, 2023 · 6 comments
Open

Trim option on the Length validator #3366

SkwalExe opened this issue Sep 21, 2023 · 6 comments

Comments

@SkwalExe
Copy link

Would it be a good idea to implement a trim option on the input Length validator?
It could be useful for example when you want the user to input at least 2 chars but not spaces.

Should I create a pull request ?

@Textualize Textualize deleted a comment from github-actions bot Sep 21, 2023
@darrenburns
Copy link
Member

Could you describe what this means in a little more detail? I'm not understanding what this option would do.

@SkwalExe
Copy link
Author

When using the Length() validator you could do something like Length(..., trim=True) and the length would be checked on the trimmed value of the input instead of being directly checked on the value.

The "trimmed value" is the value without the trailing and leading spaces

@darrenburns
Copy link
Member

Oh, I like this idea. @willmcgugan would we accept a PR for this?

@willmcgugan
Copy link
Collaborator

Sure, seems reasonable...

@SkwalExe
Copy link
Author

#3373

@SkwalExe
Copy link
Author

SkwalExe commented Sep 21, 2023

This is one of my first contributions to an open source project, please tell me if I did anything wrong :)

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

No branches or pull requests

3 participants