4 Answers, 1 is accepted
Hello, Dan,
I'm afraid that you cannot directly plug in the server error in the client validation of the Upload component. However, what you can do is - handle the error event of the upload component and display the custom error:
https://docs.telerik.com/kendo-ui/api/javascript/ui/upload/events/error
The event will be triggered if you throw a new exception on the server and pass back the text of the error for example. Then, in the event handling, you can read the error message and display it in a preferable manner. Keep in mind that the red validation will paint the Upload component, but you would need to manually append the error message (or alert such).
Hope this would help.
Regards,
Nencho
Progress Telerik
Hi Nencho,
I already handle the error and got the message my problem is displaying it like the extension/max file size in the widget (with the colors and icons and the html structure) I hoped that the widget would provide a functionality so that if I do this not to have backward compatibility issues when updating the newer versions like before.
Thanks anyway.
Hi Dan,
With regard to the widget's functionality when it comes to showing custom messages, it allows you to use a template. In it you can nest arbitrary Html and show/hide some of the elements conditionally.
Here's a dojo example, that shows how you can have a template and still display validation messages by showing/hiding the span with class "validation-message", depending on the extension of the selected file: https://dojo.telerik.com/aGiLudOl
Consider using a similar approach in your scenario - show/hide the element that contains the message with jQuery, when the error event fires.
Regards,
Ivan Danchev
Progress Telerik
Hi Ivan
Thank you for the suggesting template. I did not think of using it and it seems to be a valid solution.