Topic: MDBootstrap issue with Validators

Castillo pro asked 6 years ago


Hello everyone. I trying to use the Validators example in https://mdbootstrap.com/angular/forms/forms/, but the only rule that is working is "required".  I appreciate your help because I lost a lot of time finding the answer. Even the same code in the above link dosn't work properly.

Start your code here
constructor(private fb: FormBuilder) {
        this.loginForm = fb.group({
            defaultFormEmail: ['', Validators.required], // work
            defaultFormPass: ['', [Validators.required, Validators.minLength(8)]] // minLength dosn't work
        });
}


Castillo pro commented 6 years ago

BTW I am very disappoint with the support, product and website in general. The way from to put a code is very hard

Damian Gemza staff commented 6 years ago

Dear Castillo, could you show me your HTML markup? Code which shows or hide a proper message is in HTML markup. About our Support Forum - we're working on implementing a new version of our forum. In next months, it will be available. Best Regards, Damian

Damian Gemza staff answered 6 years ago


Castillo, Please try this code in your .md-form div:
<div *ngIf="loginForm.controls['defaultFormEmail'].errors && loginForm.controls['defaultFormEmail'].touched">

<span *ngIf="loginForm.controls['defaultFormEmail'].errors.minlength"class="inputVal text-danger">Error occurs</span>

</div>
Best Regards,
Damian

Hector Alejandro Rodriguez free commented 5 years ago

Bacana, Damian. Thanks for the help, I was able to solve when I got an error, now as a change when it's success ...

Damian Gemza staff commented 5 years ago

Dear Hector, Do you still need help? If yes, please describe your problem. Best Regards, Damian


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: Yes
  • Provided link: No
Tags