Topic: is possible validate a mdb-file-upload ?

DEVGASA priority asked 7 months ago


Expected behavior validate a mdb-file-upload with a reactive form

Actual behavior the mdb-file-upload don't have validation

Resources (screenshots, code snippets etc.) How can we validate the mdb-file-upload using a reactive form?

example using:

<mdb-file-upload #fileUpload
          [removeBtn]="'Delete'" [defaultMsg]="'Select a image'"
         [removeBtnDisabled]="true"
          (fileAdded)="onFileAdded($event)">
        </mdb-file-upload>

is it possible to include it in a formControlName? How can we validate that it has a selected file?


Arkadiusz Idzikowski staff answered 7 months ago


This plugin has built-in validation for things like file size, type or quantity but it is not possible to add required validation using formControlName.

To check if a file is added you could create a new local variable and update it accordingly when (fileAdded) or (fileRemoved) events are fired.



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Angular
  • MDB Version: MDB5 5.1.0
  • Device: PC
  • Browser: Chrome 117.0.5938.63
  • OS: Windows 11
  • Provided sample code: No
  • Provided link: No