Topic: reset validation of inputs

Ruleat pro asked 5 years ago


Damian Gemza staff answered 5 years ago


Dear Ruleat, That's a bug, and we have to fix it. But for now, please use this workaround: .ts code:
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();

}
Best Regards, Damian

Ruleat pro commented 5 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 remain

Damian Gemza staff commented 5 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, Damian

igor romanovsky free commented 5 years ago

Hi. Any update about this issue ?

Damian Gemza staff commented 5 years ago

Dear Igor, This problem was fixed with 6.2.0 release. Best Regards, Damian

Ruleat pro answered 5 years ago


hi i want reset input validator after formgroup reset



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags