The Form TagHelper does not provide support for hidden fields, similar to the HtmlHelper.
The Form TagHelper does not allow similar built-in configuration:
.Items(i =>
{
i.Add()
.Field(f => f.UserID)
.Editor(editor => editor.Hidden());
})
The Form TagHelper should support hidden inputs.
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>