-
Notifications
You must be signed in to change notification settings - Fork 0
FormFieldTagHelper
StrutTower edited this page Feb 23, 2024
·
3 revisions
Tag helper that generates all of the standard elements used in a form for a field
<formField asp-for="StringProperty"></formField>
<formField asp-for="IntProperty"></formField>
<formField asp-for="DateOnlyProperty" renderer="Date"></formField><div class="mb-3">
<label for="StringProperty">StringProperty</label>
<input type="text" id="StringProperty" name="StringProperty" class="form-control" />
<span>[Default validate span]</span>
<div class="ps-2 text-muted small">Description of property</div>
</div>
<div class="mb-3">
<label for="IntProperty">IntProperty</label>
<input type="number" id="IntProperty" name="IntProperty" class="form-control" />
<span>[Default validate span]</span>
<div class="ps-2 text-muted small">Description of property</div>
</div>
<div class="mb-3">
<label for="DateOnlyProperty">DateOnlyProperty</label>
<input type="date" id="DateOnlyProperty" name="DateOnlyProperty" class="form-control" />
<span>[Default validate span]</span>
<div class="ps-2 text-muted small">Description of property</div>
</div>| Name | Required | Data Type | Description |
|---|---|---|---|
| asp-for | Required | ModelExpression | The property for this field |
| template | Optional | String | Key name the HtmlRender that will be used for rendering the input |
| label | Optional | String | Overrides the default label string used for this field |
| input-css | Optional | String | Add the supplied class values to the input element |
More info on HtmlRenderers.