Custom Editor in Forms Component with TagHelper

1 Answer 38 Views
Form
Andreas
Top achievements
Rank 1
Andreas asked on 30 Nov 2023, 08:22 AM

Hi,

I need to create a custom editor to provide an upload field in my form component. I have seen posts and this documentation about creating custom editors with the HtmlHelper approach but can't find anything for the TagHelper approach.

Please can you point me in the right direction?

1 Answer, 1 is accepted

Sort by
0
Mihaela
Telerik team
answered on 01 Dec 2023, 04:19 PM

Hello Andreas,

You could add the Upload component when using the TagHelper Form by using the "editor-handler" attribute. For example:

<form-item field="files" editor-handler="customEditor">
</form-item>

<script>
    function customEditor(container, options) {
        $('<input id="files" type="file" name="' + options.field + '"/>')
                .appendTo(container);
        }

    $(document).ready(function () {
        $("#files").kendoUpload(); //Initialize the Upload with jQuery
    });
</script>

I will update the Custom Editor section in the documentation with a TagHelper example.

I hope that helps.

 

Regards,
Mihaela
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.
Tags
Form
Asked by
Andreas
Top achievements
Rank 1
Answers by
Mihaela
Telerik team
Share this question
or