Show / Hide Table of Contents

    Class DefaultFormTemplate

    The default Chameleon Forms form template renderer.

    Inheritance
    System.Object
    DefaultFormTemplate
    TwitterBootstrap3FormTemplate
    Implements
    IFormTemplate
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: ChameleonForms.Templates.Default
    Assembly: ChameleonForms.Templates.dll
    Syntax
    public class DefaultFormTemplate : IFormTemplate

    Methods

    | Improve this Doc View Source

    BeginField(IHtmlContent, IHtmlContent, IHtmlContent, ModelMetadata, IReadonlyFieldConfiguration, Boolean)

    Creates the beginning HTML for a single form field that contains other fields nested within it.

    Declaration
    public virtual 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

    | Improve this Doc View Source

    BeginForm(String, FormMethod, HtmlAttributes, Nullable<EncType>)

    Creates the starting HTML for a form.

    Declaration
    public virtual 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

    | Improve this Doc View Source

    BeginMessage(MessageType, IHtmlContent)

    Creates the beginning HTML for a message.

    Declaration
    public virtual 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

    | Improve this Doc View Source

    BeginNavigation()

    Creates the beginning HTML for a navigation section.

    Declaration
    public virtual IHtmlContent BeginNavigation()
    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent

    The beginning HTML for a navigation section

    | Improve this Doc View Source

    BeginNestedSection(IHtmlContent, IHtmlContent, HtmlAttributes)

    Creates the beginning HTML for a section that is nested within another section.

    Declaration
    public virtual 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

    | Improve this Doc View Source

    BeginSection(IHtmlContent, IHtmlContent, HtmlAttributes)

    Creates the beginning HTML for a section.

    Declaration
    public virtual 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

    | Improve this Doc View Source

    Button(IHtmlContent, String, String, String, HtmlAttributes)

    Creates the HTML for a button.

    Declaration
    public virtual 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

    Remarks

    Uses an <input> by default so the submitted value works in IE7. See http://rommelsantor.com/clog/2012/03/12/fixing-the-ie7-submit-value/

    | Improve this Doc View Source

    EndField()

    Creates the ending HTML for a single form field that contains other fields nested within it.

    Declaration
    public virtual IHtmlContent EndField()
    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent

    The ending HTML for the parent field

    | Improve this Doc View Source

    EndForm()

    Creates the ending HTML for a form.

    Declaration
    public virtual IHtmlContent EndForm()
    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent

    The ending HTML for a form

    | Improve this Doc View Source

    EndMessage()

    Creates the ending HTML for a message.

    Declaration
    public virtual IHtmlContent EndMessage()
    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent

    The ending HTML for the message

    | Improve this Doc View Source

    EndNavigation()

    Creates the ending HTML for a navigation section.

    Declaration
    public virtual IHtmlContent EndNavigation()
    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent

    The ending HTML for a navigation section

    | Improve this Doc View Source

    EndNestedSection()

    Creates the ending HTML for a section that is nested within another section.

    Declaration
    public virtual IHtmlContent EndNestedSection()
    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent

    The ending HTML for a nested section

    | Improve this Doc View Source

    EndSection()

    Creates the ending HTML for a section.

    Declaration
    public virtual IHtmlContent EndSection()
    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent

    The ending HTML for a section

    | Improve this Doc View Source

    Field(IHtmlContent, IHtmlContent, IHtmlContent, ModelMetadata, IReadonlyFieldConfiguration, Boolean)

    Creates the HTML for a single form field.

    Declaration
    public virtual 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

    | Improve this Doc View Source

    MessageParagraph(IHtmlContent)

    Creates the HTML for a paragraph in a message.

    Declaration
    public virtual 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

    | Improve this Doc View Source

    PrepareFieldConfiguration<TModel, T>(IFieldGenerator<TModel, T>, IFieldGeneratorHandler<TModel, T>, IFieldConfiguration, FieldParent)

    Allows the template the modify the field configuration for a particular field.

    Declaration
    public virtual 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

    | Improve this Doc View Source

    RadioOrCheckboxList(IEnumerable<IHtmlContent>, Boolean)

    Creates the HTML for a list of radio buttons or checkboxes.

    Declaration
    public virtual 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

    | Improve this Doc View Source

    RequiredDesignator(ModelMetadata, IReadonlyFieldConfiguration, Boolean)

    Creates the HTML for a required designator for a single form field (will only be output if the field is required).

    Declaration
    protected virtual IHtmlContent RequiredDesignator(ModelMetadata fieldMetadata, IReadonlyFieldConfiguration fieldConfiguration, bool isValid)
    Parameters
    Type Name Description
    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 required designator of field with the given information

    Implements

    IFormTemplate

    Extension Methods

    HtmlAttributesExtensions.ToHtmlAttributes(Object)
    • Improve this Doc
    • View Source
    Back to top © Copyright 2012-2020 MRCollective, Rob Moore, Matt Davies and the contributors to ChameleonForms.