-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
[form.rule] Rename empty
rule to be consistent
#2937
Comments
empty
rule to notEmpty
to be consistentempty
rule to be consistent
I would be happy if the better named |
Ok, i am preparing a PR. I thought about naming the new rule Opinions? |
Mmh, |
Perhaps
There could possibly be use case where one needs to check that a field is |
Good points. I personally would prefer one function/name for "the 99% usecases", ie. a function that will check if the length is not zero after whitespaces are trimmed from the ends. The reason I do not support additional function to check if an input is:
is that the first is not much useful in practice and the second is hard to define and basically any app needs a different criateria, like for some apps About the name, |
I've often wondered about this same issue, and came across this looking for something else. The negation issue is most-striking when sitting alongside other validations: fields: {
'host[first_name]': {
rules: [
{ type: 'empty' },
{ type: 'maxLength[50]' },
]
} It appears the value needs to empty and less than 50 characters. As for the name, coming from a Rails background, the validates :first_name, presence: true, length: { maximum: 50 } |
Thank you for supporting this issue, but |
I prepared that by #2949 Edit: The trimming functionality is already inbuild via various possible "shouldTrim" setting (which is true by default) |
Thank you all! |
Feature Request
originally posted in atk4/ui#2129
Currently, the
empty
form rule is very, very confusing as the logic is negated with the remaining names.empty
means "nothing", but the rule validates the form field is "filled / not empty".here atk4/ui#2129 (comment) is this fact more evident when compared with other rules like
checked
oris[dog]
This is a feature request to rename
empty
form rule to something likenotEmpty
ormandatory
. For BC, theempty
can be kept with a console warning.The text was updated successfully, but these errors were encountered: