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

Max chars input validation #375

Merged
merged 2 commits into from
Dec 19, 2020
Merged

Max chars input validation #375

merged 2 commits into from
Dec 19, 2020

Conversation

drehelis
Copy link
Contributor

Adding max_chars config parameter to a text field.

I sometime require limit user input to specific number of chars. I've been doing this until now with-in the executed script but I find it much useful this way.

@@ -277,6 +279,9 @@ def validate_value(self, value, *, ignore_required=False):
return None

if self.type == 'text':
if (not is_empty(self.max_chars)) and (len(value) > int(self.max_chars)):
return 'is greater than allowed char length (' \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change "greater" to "longer?

@@ -27,6 +27,7 @@
'type',
'min',
'max',
'max_chars',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be we could call it "max_length"? What do you think?

@drehelis drehelis force-pushed the max_chars branch 2 times, most recently from 61026aa to 9f40c57 Compare December 11, 2020 11:08
@drehelis
Copy link
Contributor Author

Got a little confused and mistakenly pushed something else. Please have another look. Apologies for that.

@drehelis
Copy link
Contributor Author

@bugy is there anything else required here?

@bugy
Copy link
Owner

bugy commented Dec 19, 2020 via email

@bugy bugy added the feature label Dec 19, 2020
@bugy bugy added this to the 1.17.0 milestone Dec 19, 2020
@bugy bugy merged commit b6b1ca9 into bugy:master Dec 19, 2020
@drehelis drehelis deleted the max_chars branch December 19, 2020 17:33
bugy added a commit that referenced this pull request Dec 19, 2020
bugy added a commit that referenced this pull request May 24, 2021
@bugy bugy added the resolved label Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants