Topic: Input validation showing 'wrong' for text-box without required validation
kayes.islam.ocean pro asked 6 years ago
Hi,
I am not an MDB Pro user, however evaluating the current version for our project.
I am just trying the sample form input and noticing an strange behavior there. When I click on an input box that does not have validation, then click out of it without editing it, the validation error message shows with text "wrong". This is what I have done:
- I have downloaded the "mdb-angular-free-6.1.1"
- I have applied the form sample from the documentation here: https://mdbootstrap.com/angular/forms/forms/
You can download the code here:
https://drive.google.com/open?id=1uGLtPtPJ8bxfcW4kSoDBxnMfKlJNOzvb
Let me know if this is a possible bug or if it's something I am not doing right.
Regards
Kayes
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- ForumUser: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No
Damian Gemza staff commented 6 years ago
Dear kayes.islam.ocean, Please use [mdbValidate]="false" control on your input. Best Regards, Damiankayes.islam.ocean pro commented 6 years ago
Please note that this behavior is also present on your demo page: http://ng-admin-pro.mdbootstrap.com/forms/form1. Just click on the email text-box then click away.Damian Gemza staff commented 6 years ago
Dear kayes, I don't know what's wrong there? Are you talking about those 'wrong' message? That's correct, because this field is validating to get proper email address.kayes.islam.ocean pro commented 6 years ago
Thank you for suggesting [mdbValidate]=”false”. That does turn off the validation, so I don't get the "wrong" message anymore. But that being said, in my example (that I've provided the link to), I've set up my reactive inputs as this: this.loginForm = fb.group({ defaultFormEmail: ['', null], defaultFormPass: ['', null] }); Which means no validators, so they should not perform any validations. Also checking the validation classes on the control I get these: [form-control ng-pristine ng-valid counter-danger ng-touched]. Presense of ng-valid there tells me that angular renders it as valid. This is also added on my example. Please have a look.Damian Gemza staff commented 6 years ago
Dear Kayes, Here you can find more information about our validation: https://mdbootstrap.com/angular/forms/input-validation/ In MDB you're able to use 2 types of validation. 1st type - validation which comes from mdbInputDirective. Turning it off with [mdbValidate]="false" control. 2nd type - Validators from Angular. The mdbInputDirective validation is not related with Angular Validators. So if you're passing no validators in your formControlNames, we are not responsible for placing ng-valid class. This Angular gives you ng-valid classes and the like. Does my answer satisfy you?kayes.islam.ocean pro commented 6 years ago
Yes, thank you.