-
Notifications
You must be signed in to change notification settings - Fork 433
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
'required' is needed to handle separately #241
Comments
+1 It will be great if minLength:1 checked that field value is not null, '' or undefined |
So, I did some digging in the implementation and it looks like when you use the |
+1 |
+1 |
I came up with a workaround that goes agaisnt recommended usage but it works:
|
@dsteinbach , @eriknyk , @CrisLi , @dayAlone why? What should I do if I want to validate |
See #135 |
I have a very simple input component.
The issue is when user doesn't input any thing and submits the form, the
isValid()
method will return false since therequired
is not met. ButgetErrorMessage()
method is returning null. I have to add some additional code to handle required validation.If I remove the
required
the props, then if user submits the form without any inputs, theminLength:2
validation will be passed.I think in the most of cases, developers will like to let
null
,''
andundefined
not meet validation ofminLength:2
, then we don't have to handle 'required' separately. We can change our code likeand the error message will display when user input nothing in the form.
Or is there any possible to let
getErrorMessage()
method return a message whenrequired
is not met.The comments on the #216 is very clear but the api is convenience enough.
validations prop => showError() / getErrorMessages()
required prop => showRequired()
The text was updated successfully, but these errors were encountered: