This is a migrated thread and some comments may be shown as answers.

Required Validator with AutoUpload = False

2 Answers 70 Views
Upload
This is a migrated thread and some comments may be shown as answers.
n/a
Top achievements
Rank 1
n/a asked on 22 Aug 2019, 04:09 PM

I have autoupload = false, multiple=false and my own custom upload button that calls the uploadfiles method.

I am trying to use kendo reactive forms validation.  However, the validator appears to consider the kendo upload empty/not set if the file has not been uploaded to the server.   

How do I check that a file has been selected prior to calling uploadfiles?

2 Answers, 1 is accepted

Sort by
0
n/a
Top achievements
Rank 1
answered on 22 Aug 2019, 04:53 PM

Not sure if this is the best way but I just used the event handlers to flag if a file is selected.  Would be nice if the list of selected files was exposed.

 

selectEventHandler(e: SelectEvent) {
  this.fileSelected = true;
}
 
 
clearEventHandler(e: ClearEvent) {
  this.fileSelected = false;
}
0
Dimiter Madjarov
Telerik team
answered on 26 Aug 2019, 07:16 AM
Hi John,


Indeed the default Upload component validation is triggered only for successfully uploaded files. In the current case we could define a custom Angular validator that checks a boolean flag indicating whether a file is selected. Similarly to the currently used approach.

Regards,
Dimiter Madjarov
Progress Telerik
Get quickly onboarded and successful with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Upload
Asked by
n/a
Top achievements
Rank 1
Answers by
n/a
Top achievements
Rank 1
Dimiter Madjarov
Telerik team
Share this question
or