Completed
Last Updated: 13 Oct 2022 07:40 by ADMIN
Release R1.2023-Increment.1(09.Nov.2022)
René Spruit
Created on: 15 Sep 2022 06:57
Category: Form
Type: Bug Report
0
The Form TagHelper does not support for hidden fields

Bug report

The Form TagHelper does not provide support for hidden fields, similar to the HtmlHelper.

Reproduction of the problem

The Form TagHelper does not allow similar built-in configuration:

.Items(i =>
            {
            i.Add()
                .Field(f => f.UserID)
                .Editor(editor => editor.Hidden());
            })

Expected/desired behavior

The Form TagHelper should support hidden inputs.

Workaround

Similar result can be achieved by setting the editor-handler attribute, creating a hidden input and setting an empty label:

<form-items>
    <form-item field="UserID" editor-handler="hiddenEditor" >
        <item-label text=" " />
    </form-item>
</form-items>

<script>
    function hiddenEditor(container, options) {
        $('<input type="hidden" data-bind="value: ' + options.field + '" name="' + options.field + '"/>')
            .appendTo(container);
    }
</script>

Environment

  • Kendo UI version: 2022.3.913
  • Browser: [all]
0 comments