Topic: reset validation of inputs
Damian Gemza staff answered 6 years ago
loginForm: FormGroup; constructor(private fb:FormBuilder, private _el:ElementRef, private _r:Renderer2) { this.loginForm=fb.group({ defaultFormEmail: ['', Validators.required], defaultFormPass: ['', [Validators.required, Validators.minLength(8)]] }); } reset() { let validations = this._el.nativeElement.querySelectorAll('.inputVal'); let inputs = this._el.nativeElement.querySelectorAll('input'); inputs.forEach(element=> { this._r.removeClass(element, 'counter-success'); this._r.removeClass(element, 'counter-danger'); }) validations.forEach(element=> { this._r.setStyle(element, 'display', 'none'); }) this.loginForm.reset(); }
Ruleat pro commented 6 years ago
hi Damian thank but the code don't work, I have updated to version 6.1.6 but the validator colors continue to remainDamian Gemza staff commented 6 years ago
Dear Ruleat, What exactly doesn't work there? I copied this code to my app, copied the Login Form code from our docs, and into a button I have placed a method reset() which on (click) event, and for me, everything is working fine. Best Regards, Damianigor romanovsky free commented 6 years ago
Hi. Any update about this issue ?Damian Gemza staff commented 6 years ago
Dear Igor, This problem was fixed with 6.2.0 release. Best Regards, DamianFREE 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