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

Validate data before uploading async

2 Answers 63 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Iron
Alex asked on 21 Jul 2015, 08:50 AM

Hi

I try to use the upload widget in async mode to present a progress bar.

I add a bunch of form data within the upload event which works fine. Now I would like to validate the form data before uploading the file. If I do this in the upload event as well and set e.preventDefault() if validation fails, the list of selected files is cleared in the upload widget which doesn't make sense in this scenario as the customer is forced to correct the form data AND select the images again.

Is there a way to validate data before uploading a file without loosing the list of selected files?

 

Regards

 

Alex Bernhard

 

2 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 22 Jul 2015, 10:29 AM

Hello Alex,

The current behavior is by design - if the upload event is prevented, the list files is cleared. I would suggest to reconsider the approach and validate the rest of the form data earlier.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Alex
Top achievements
Rank 1
Iron
answered on 22 Jul 2015, 10:39 AM

Hi

thank you for your reply. That's what I expected. I solved the problem by validation in the select event. It is not completely intuitive as the customers cannot select an image before having filled all form values correctly. Its much more common that validation occurs on blur or when trying to send the form / upload the image but it works.

Thank you very much for your support.
Alex

Tags
Upload
Asked by
Alex
Top achievements
Rank 1
Iron
Answers by
Dimiter Madjarov
Telerik team
Alex
Top achievements
Rank 1
Iron
Share this question
or