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

5 posts, 0 answers
  1. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 11 Jul 2014 Link to this post

    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;
                }
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 14 Jul 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 14 Jul 2014 in reply to Dimiter Madjarov Link to this post

    Anyway to disable the upload button until a description is entered in an input box?
  5. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 16 Jul 2014 Link to this post

    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!
     
  6. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 17 Jul 2014 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready