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

How do I require a description, e.preventDefault() clears my current file

4 Answers 358 Views
Upload
This is a migrated thread and some comments may be shown as answers.
danparker276
Top achievements
Rank 2
danparker276 asked on 11 Jul 2014, 11:24 PM
on the OnUpload, I can validate that I have set a description textbox, but it will clear my current file selected.  Anyway to keep my current file?


        function onUpload(e) {

            var files = e.files;
            var description = $.trim($("#fileDescription").val());
            if (description.length < 1) {
                alert("Must have a description")
                e.preventDefault();

                    return;
            }

4 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 14 Jul 2014, 11:12 AM
Hi Dan,


This behavior is by design - if the upload event is prevented, the file will be remove from the list. At the moment there is no workaround for this, so I would suggest you to reconsider the approach. Please excuse us if this is causing an inconvenience.

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
danparker276
Top achievements
Rank 2
answered on 14 Jul 2014, 05:03 PM
Anyway to disable the upload button until a description is entered in an input box?
0
Dimiter Madjarov
Telerik team
answered on 16 Jul 2014, 08:55 AM
Hi Dan,


At the moment I cannot suggest a workaround for this scenario, but I have passed the suggestion to the developers team, so we could improve this aspect of the Upload widget.

Please excuse us for the inconvenience caused.

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
Dimiter Madjarov
Telerik team
answered on 17 Jul 2014, 09:14 AM
Hello Dan,


We have pushed a fix for this behavior, which will be available in the first internal build after the official release from yesterday. It would allow disabling the widget in the select event handler, which will be useful in a combination with the async.autoUpload option set to false. This will not allow the user to start the file upload until a description is given (afterwards you should enable the widget again).

I hope this information helps. Have a great day!

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Upload
Asked by
danparker276
Top achievements
Rank 2
Answers by
Dimiter Madjarov
Telerik team
danparker276
Top achievements
Rank 2
Share this question
or