Interface IFormTemplate
A Chameleon Forms form template renderer.
Namespace: ChameleonForms.Templates
Assembly: ChameleonForms.Core.dll
Syntax
public interface IFormTemplate
Methods
| Improve this Doc View SourceBeginField(IHtmlContent, IHtmlContent, IHtmlContent, ModelMetadata, IReadonlyFieldConfiguration, Boolean)
Creates the beginning HTML for a single form field that contains other fields nested within it.
Declaration
IHtmlContent BeginField(IHtmlContent labelHtml, IHtmlContent elementHtml, IHtmlContent validationHtml, ModelMetadata fieldMetadata, IReadonlyFieldConfiguration fieldConfiguration, bool isValid)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Html.IHtmlContent | labelHtml | The HTML that comprises the form label |
Microsoft.AspNetCore.Html.IHtmlContent | elementHtml | The HTML that comprieses the field itself |
Microsoft.AspNetCore.Html.IHtmlContent | validationHtml | The HTML that comprises the field's validation messages |
Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata | fieldMetadata | The metadata for the field being created |
IReadonlyFieldConfiguration | fieldConfiguration | Configuration for the field |
System.Boolean | isValid | Whether or not the field is valid |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The beginning HTML for the parent field |
BeginForm(String, FormMethod, HtmlAttributes, Nullable<EncType>)
Creates the starting HTML for a form.
Declaration
IHtmlContent BeginForm(string action, FormMethod method, HtmlAttributes htmlAttributes, EncType? enctype)
Parameters
Type | Name | Description |
---|---|---|
System.String | action | The form action |
Microsoft.AspNetCore.Mvc.Rendering.FormMethod | method | The form method |
HtmlAttributes | htmlAttributes | Any HTML attributes the form should use; specified as an anonymous object |
System.Nullable<EncType> | enctype | The encoding type for the form |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The starting HTML for a form |
BeginMessage(MessageType, IHtmlContent)
Creates the beginning HTML for a message.
Declaration
IHtmlContent BeginMessage(MessageType messageType, IHtmlContent heading)
Parameters
Type | Name | Description |
---|---|---|
MessageType | messageType | The type of message being displayed |
Microsoft.AspNetCore.Html.IHtmlContent | heading | The heading for the message |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The beginning HTML for the message |
BeginNavigation()
Creates the beginning HTML for a navigation section.
Declaration
IHtmlContent BeginNavigation()
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The beginning HTML for a navigation section |
BeginNestedSection(IHtmlContent, IHtmlContent, HtmlAttributes)
Creates the beginning HTML for a section that is nested within another section.
Declaration
IHtmlContent BeginNestedSection(IHtmlContent heading = null, IHtmlContent leadingHtml = null, HtmlAttributes htmlAttributes = null)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Html.IHtmlContent | heading | The heading of the nested section |
Microsoft.AspNetCore.Html.IHtmlContent | leadingHtml | Any HTML to output at the start of the nested section |
HtmlAttributes | htmlAttributes | Any HTML attributes the nested section container should use; specified as an anaonymous object |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The beginning HTML for a nested section |
BeginSection(IHtmlContent, IHtmlContent, HtmlAttributes)
Creates the beginning HTML for a section.
Declaration
IHtmlContent BeginSection(IHtmlContent heading = null, IHtmlContent leadingHtml = null, HtmlAttributes htmlAttributes = null)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Html.IHtmlContent | heading | The heading of the section |
Microsoft.AspNetCore.Html.IHtmlContent | leadingHtml | Any HTML to output at the start of the section |
HtmlAttributes | htmlAttributes | Any HTML attributes the section container should use; specified as an anonymous object |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The beginning HTML for a section |
Button(IHtmlContent, String, String, String, HtmlAttributes)
Creates the HTML for a button.
Declaration
IHtmlContent Button(IHtmlContent content, string type, string id, string value, HtmlAttributes htmlAttributes)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Html.IHtmlContent | content | The content for the user to see or null if the value should be used instead |
System.String | type | The type of button or null if a generic button should be used |
System.String | id | The name/id of the button or null if one shouldn't be set |
System.String | value | The value to submit if the button is clicked or null if one shouldn't be set |
HtmlAttributes | htmlAttributes | Any HTML attributes to add to the button or null if there are none |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The HTML for the button |
EndField()
Creates the ending HTML for a single form field that contains other fields nested within it.
Declaration
IHtmlContent EndField()
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The ending HTML for the parent field |
EndForm()
Creates the ending HTML for a form.
Declaration
IHtmlContent EndForm()
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The ending HTML for a form |
EndMessage()
Creates the ending HTML for a message.
Declaration
IHtmlContent EndMessage()
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The ending HTML for the message |
EndNavigation()
Creates the ending HTML for a navigation section.
Declaration
IHtmlContent EndNavigation()
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The ending HTML for a navigation section |
EndNestedSection()
Creates the ending HTML for a section that is nested within another section.
Declaration
IHtmlContent EndNestedSection()
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The ending HTML for a nested section |
EndSection()
Creates the ending HTML for a section.
Declaration
IHtmlContent EndSection()
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The ending HTML for a section |
Field(IHtmlContent, IHtmlContent, IHtmlContent, ModelMetadata, IReadonlyFieldConfiguration, Boolean)
Creates the HTML for a single form field.
Declaration
IHtmlContent Field(IHtmlContent labelHtml, IHtmlContent elementHtml, IHtmlContent validationHtml, ModelMetadata fieldMetadata, IReadonlyFieldConfiguration fieldConfiguration, bool isValid)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Html.IHtmlContent | labelHtml | The HTML that comprises the form label |
Microsoft.AspNetCore.Html.IHtmlContent | elementHtml | The HTML that comprieses the field itself |
Microsoft.AspNetCore.Html.IHtmlContent | validationHtml | The HTML that comprises the field's validation messages |
Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata | fieldMetadata | The metadata for the field being created |
IReadonlyFieldConfiguration | fieldConfiguration | Configuration for the field |
System.Boolean | isValid | Whether or not the field is valid |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The HTML for the field |
MessageParagraph(IHtmlContent)
Creates the HTML for a paragraph in a message.
Declaration
IHtmlContent MessageParagraph(IHtmlContent paragraph)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Html.IHtmlContent | paragraph | The paragraph HTML |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The HTML for the message paragraph |
PrepareFieldConfiguration<TModel, T>(IFieldGenerator<TModel, T>, IFieldGeneratorHandler<TModel, T>, IFieldConfiguration, FieldParent)
Allows the template the modify the field configuration for a particular field.
Declaration
void PrepareFieldConfiguration<TModel, T>(IFieldGenerator<TModel, T> fieldGenerator, IFieldGeneratorHandler<TModel, T> fieldGeneratorHandler, IFieldConfiguration fieldConfiguration, FieldParent fieldParent)
Parameters
Type | Name | Description |
---|---|---|
IFieldGenerator<TModel, T> | fieldGenerator | The instance of the field generator that will be used to generate the field |
IFieldGeneratorHandler<TModel, T> | fieldGeneratorHandler | The instance of the field generator handler that will be used to generate the field element |
IFieldConfiguration | fieldConfiguration | The field configuration that is being used to configure the field |
FieldParent | fieldParent | The parent component of the field |
Type Parameters
Name | Description |
---|---|
TModel | The type of model the form is being displayed for |
T | The type of the property the field is being generated against |
RadioOrCheckboxList(IEnumerable<IHtmlContent>, Boolean)
Creates the HTML for a list of radio buttons or checkboxes.
Declaration
IHtmlContent RadioOrCheckboxList(IEnumerable<IHtmlContent> list, bool isCheckbox)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Html.IHtmlContent> | list | The list of HTML items (one per radio/checkbox) |
System.Boolean | isCheckbox | Whether the list is for checkboxes rather than radio buttons |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The HTML for the radio list |