InputType.Hidden?
Opened this issue · 3 comments
Hi, I'd like to generate an input type=hidden field, but Hidden is not in the InputType collection. Any workarounds? (except Html.HiddenFor() )
Use "standard" Html.HiddenFor(...)
helper.
I could not imagine any improvements for default one, so I didn't introduced any "my" version.
I understand - I'm trying to implement a 'BootstrapMVC-only' UI-generator :)
First, you may create new IFormControl
, say HiddenValue
, using StaticValue and StaticValueExtensions as a sample. But this will require you to create FormGroup
for each field you want to put as hidden, this will lead to extra html markup in your form, which is usually bad (for hidden fields).
Better solution is to create new Element
like FormGroup
that will hold IControlContext
only for it's own. Look into new commit 8067f8e - it contains two new classes (element and extensions) you may copy to your project.