Show / Hide Table of Contents

    Interface IFieldConfiguration

    Holds configuration data for a form field.

    Inherited Members
    Microsoft.AspNetCore.Html.IHtmlContent.WriteTo(System.IO.TextWriter, System.Text.Encodings.Web.HtmlEncoder)
    IReadonlyFieldConfiguration.Bag
    IReadonlyFieldConfiguration.GetBagData<TData>(String)
    IReadonlyFieldConfiguration.HtmlAttributes
    IReadonlyFieldConfiguration.InlineLabelText
    IReadonlyFieldConfiguration.LabelText
    IReadonlyFieldConfiguration.DisplayType
    IReadonlyFieldConfiguration.TrueString
    IReadonlyFieldConfiguration.FalseString
    IReadonlyFieldConfiguration.NoneString
    IReadonlyFieldConfiguration.Hint
    IReadonlyFieldConfiguration.PrependedHtml
    IReadonlyFieldConfiguration.AppendedHtml
    IReadonlyFieldConfiguration.FieldHtml
    IReadonlyFieldConfiguration.FormatString
    IReadonlyFieldConfiguration.EmptyItemHidden
    IReadonlyFieldConfiguration.HasLabelElement
    IReadonlyFieldConfiguration.LabelClasses
    IReadonlyFieldConfiguration.FieldContainerClasses
    IReadonlyFieldConfiguration.ValidationClasses
    IReadonlyFieldConfiguration.ExcludedEnums
    IReadonlyFieldConfiguration.HasInlineLabel
    IReadonlyFieldConfiguration.ShouldInlineLabelWrapElement
    IReadonlyFieldConfiguration.HintId
    Namespace: ChameleonForms.Component.Config
    Assembly: ChameleonForms.Core.dll
    Syntax
    public interface IFieldConfiguration : IHtmlContent, IReadonlyFieldConfiguration

    Properties

    | Improve this Doc View Source

    Attributes

    Attributes to add to the form element's HTML.

    Declaration
    HtmlAttributes Attributes { get; }
    Property Value
    Type Description
    HtmlAttributes

    Methods

    | Improve this Doc View Source

    AddClass(String)

    Adds a CSS class (or a number of CSS classes) to the attributes.

    Declaration
    IFieldConfiguration AddClass(string class)
    Parameters
    Type Name Description
    System.String class

    The CSS class(es) to add

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    AddFieldContainerClass(String)

    Specify one or more CSS classes to use for the field container element.

    Declaration
    IFieldConfiguration AddFieldContainerClass(string class)
    Parameters
    Type Name Description
    System.String class

    Any CSS class(es) to use for the field container element

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    AddLabelClass(String)

    Specify one or more CSS classes to use for the field label.

    Declaration
    IFieldConfiguration AddLabelClass(string class)
    Parameters
    Type Name Description
    System.String class

    Any CSS class(es) to use for the field label

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    AddValidationClass(String)

    Specify one or more CSS classes to use for the field validation message.

    Declaration
    IFieldConfiguration AddValidationClass(string class)
    Parameters
    Type Name Description
    System.String class

    Any CSS class(es) to use for the field validation message

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Append(IHtmlContent)

    Appends the given HTML to the form field.

    Declaration
    IFieldConfiguration Append(IHtmlContent html)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Html.IHtmlContent html

    The HTML to append

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Append(Func<Object, IHtmlContent>)

    Appends the given HTML to the form field.

    Declaration
    IFieldConfiguration Append(Func<dynamic, IHtmlContent> html)
    Parameters
    Type Name Description
    System.Func<System.Object, Microsoft.AspNetCore.Html.IHtmlContent> html

    The HTML to append as a templated razor delegate

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Append(String)

    Appends the given string to the form field.

    Declaration
    IFieldConfiguration Append(string str)
    Parameters
    Type Name Description
    System.String str

    The string to prepend

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    AsCheckboxList()

    Renders the field as a list of radio options for selecting single values or checkbox items for selecting multiple values. Use for a list or boolean value.

    Declaration
    IFieldConfiguration AsCheckboxList()
    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    See Also
    AsRadioList()
    | Improve this Doc View Source

    AsDropDown()

    Renders the field as a drop-down control. Use for a list or boolean value.

    Declaration
    IFieldConfiguration AsDropDown()
    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    AsRadioList()

    Renders the field as a list of radio options for selecting single values or checkbox items for selecting multiple values. Use for a list or boolean value.

    Declaration
    IFieldConfiguration AsRadioList()
    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    See Also
    AsCheckboxList()
    | Improve this Doc View Source

    Attr(Func<Object, Object>)

    Adds or updates a HTML attribute with using a lambda method to express the attribute.

    Declaration
    IFieldConfiguration Attr(Func<object, object> attribute)
    Parameters
    Type Name Description
    System.Func<System.Object, System.Object> attribute

    A lambda expression representing the attribute to set and its value

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    Examples

    h.Attr(style => "width: 100%;")

    | Improve this Doc View Source

    Attr(String, Object)

    Adds or updates a HTML attribute with a given value.

    Declaration
    IFieldConfiguration Attr(string key, object value)
    Parameters
    Type Name Description
    System.String key

    The name of the HTML attribute to add/update

    System.Object value

    The value of the HTML attribute to add/update

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Attrs(IDictionary<String, Object>)

    Adds or updates a set of HTML attributes using a dictionary to express the attributes.

    Declaration
    IFieldConfiguration Attrs(IDictionary<string, object> attributes)
    Parameters
    Type Name Description
    System.Collections.Generic.IDictionary<System.String, System.Object> attributes

    A dictionary of attributes

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Attrs(IDictionary<String, String>)

    Adds or updates a set of HTML attributes using a dictionary to express the attributes.

    Declaration
    IFieldConfiguration Attrs(IDictionary<string, string> attributes)
    Parameters
    Type Name Description
    System.Collections.Generic.IDictionary<System.String, System.String> attributes

    A dictionary of attributes

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Attrs(Func<Object, Object>[])

    Adds or updates a set of HTML attributes using lambda methods to express the attributes.

    Declaration
    IFieldConfiguration Attrs(params Func<object, object>[] attributes)
    Parameters
    Type Name Description
    System.Func<System.Object, System.Object>[] attributes

    A list of lambas where the lambda variable name is the name of the attribute and the value is the value

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Attrs(Object)

    Adds or updates a set of HTML attributes using anonymous objects to express the attributes.

    Declaration
    IFieldConfiguration Attrs(object attributes)
    Parameters
    Type Name Description
    System.Object attributes

    An anonymous object of attributes

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Cols(Int32)

    Sets the number of cols for a textarea to use.

    Declaration
    IFieldConfiguration Cols(int numCols)
    Parameters
    Type Name Description
    System.Int32 numCols

    The number of cols for the textarea

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Disabled(Boolean)

    Sets the field to be disabled (value not submitted, can not click).

    Declaration
    IFieldConfiguration Disabled(bool disabled = true)
    Parameters
    Type Name Description
    System.Boolean disabled
    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Exclude(Enum[])

    Excludes one or more Enum values from the generated field.

    Declaration
    IFieldConfiguration Exclude(params Enum[] enumValues)
    Parameters
    Type Name Description
    System.Enum[] enumValues

    The value of Enum(s) to exclude from the generated field.

    Returns
    Type Description
    IFieldConfiguration
    | Improve this Doc View Source

    HideEmptyItem()

    Hide the empty item that would normally display for the field.

    Declaration
    IFieldConfiguration HideEmptyItem()
    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Id(String)

    Override the default id for the field.

    Declaration
    IFieldConfiguration Id(string id)
    Parameters
    Type Name Description
    System.String id

    The text to use for the id

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    InlineLabel(IHtmlContent)

    Sets an inline label for a checkbox.

    Declaration
    IFieldConfiguration InlineLabel(IHtmlContent labelHtml)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Html.IHtmlContent labelHtml

    The html to use for the label

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    InlineLabel(Func<Object, IHtmlContent>)

    Sets an inline label for a checkbox.

    Declaration
    IFieldConfiguration InlineLabel(Func<dynamic, IHtmlContent> labelHtml)
    Parameters
    Type Name Description
    System.Func<System.Object, Microsoft.AspNetCore.Html.IHtmlContent> labelHtml

    The html to use for the label as a templated razor delegate

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    InlineLabel(String)

    Sets an inline label for a checkbox.

    Declaration
    IFieldConfiguration InlineLabel(string labelText)
    Parameters
    Type Name Description
    System.String labelText

    The text to use for the label

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    InlineLabelWrapsElement(Boolean)

    Specify that inline labels should wrap their input element. Important for bootstrap.

    Declaration
    IFieldConfiguration InlineLabelWrapsElement(bool wrapElement = true)
    Parameters
    Type Name Description
    System.Boolean wrapElement

    True if the input element should be wrapped.

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Label(IHtmlContent)

    Override the default label for the field.

    Declaration
    IFieldConfiguration Label(IHtmlContent labelHtml)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Html.IHtmlContent labelHtml

    The text to use for the label

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Label(Func<Object, IHtmlContent>)

    Override the default label for the field.

    Declaration
    IFieldConfiguration Label(Func<dynamic, IHtmlContent> labelHtml)
    Parameters
    Type Name Description
    System.Func<System.Object, Microsoft.AspNetCore.Html.IHtmlContent> labelHtml

    The text to use for the label as a templated razor delegate

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Label(String)

    Override the default label for the field.

    Declaration
    IFieldConfiguration Label(string labelText)
    Parameters
    Type Name Description
    System.String labelText

    The text to use for the label

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Max(Decimal)

    Sets the maximum value to accept for numeric text controls.

    Declaration
    IFieldConfiguration Max(decimal max)
    Parameters
    Type Name Description
    System.Decimal max

    The maximum value to accept

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Max(Int64)

    Sets the maximum value to accept for numeric text controls.

    Declaration
    IFieldConfiguration Max(long max)
    Parameters
    Type Name Description
    System.Int64 max

    The maximum value to accept

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Max(String)

    Sets the maximum value to accept for numeric text controls.

    Declaration
    IFieldConfiguration Max(string max)
    Parameters
    Type Name Description
    System.String max

    The maximum value to accept

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Min(Decimal)

    Sets the minimum value to accept for numeric text controls.

    Declaration
    IFieldConfiguration Min(decimal min)
    Parameters
    Type Name Description
    System.Decimal min

    The minimum value to accept

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Min(Int64)

    Sets the minimum value to accept for numeric text controls.

    Declaration
    IFieldConfiguration Min(long min)
    Parameters
    Type Name Description
    System.Int64 min

    The minimum value to accept

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Min(String)

    Sets the minimum value to accept for numeric text controls.

    Declaration
    IFieldConfiguration Min(string min)
    Parameters
    Type Name Description
    System.String min

    The minimum value to accept

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    OverrideFieldHtml(IHtmlContent)

    Override the HTML of the form field.

    This gives you ultimate flexibility with your field HTML when it's not quite what you want, but you still want the form template (e.g. label, surrounding html and validation message).

    Declaration
    IFieldConfiguration OverrideFieldHtml(IHtmlContent html)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Html.IHtmlContent html

    The HTML for the field

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    OverrideFieldHtml(Func<Object, IHtmlContent>)

    Override the HTML of the form field.

    This gives you ultimate flexibility with your field HTML when it's not quite what you want, but you still want the form template (e.g. label, surrounding html and validation message).

    Declaration
    IFieldConfiguration OverrideFieldHtml(Func<dynamic, IHtmlContent> html)
    Parameters
    Type Name Description
    System.Func<System.Object, Microsoft.AspNetCore.Html.IHtmlContent> html

    The HTML for the field as a templated razor delegate

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Placeholder(String)

    Sets a hint to the user of what can be entered in the field.

    Declaration
    IFieldConfiguration Placeholder(string placeholderText)
    Parameters
    Type Name Description
    System.String placeholderText

    The text to use for the placeholder

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Prepend(IHtmlContent)

    Prepends the given HTML to the form field.

    Declaration
    IFieldConfiguration Prepend(IHtmlContent html)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Html.IHtmlContent html

    The HTML to prepend

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Prepend(Func<Object, IHtmlContent>)

    Prepends the given HTML to the form field.

    Declaration
    IFieldConfiguration Prepend(Func<dynamic, IHtmlContent> html)
    Parameters
    Type Name Description
    System.Func<System.Object, Microsoft.AspNetCore.Html.IHtmlContent> html

    The HTML to prepend as a templated razor delegate

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Prepend(String)

    Prepends the given string to the form field.

    Declaration
    IFieldConfiguration Prepend(string str)
    Parameters
    Type Name Description
    System.String str

    The string to prepend

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Readonly(Boolean)

    Sets the field to be readonly (value can not be modified).

    Declaration
    IFieldConfiguration Readonly(bool readonly = true)
    Parameters
    Type Name Description
    System.Boolean readonly
    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Required(Boolean)

    Sets the field to be required.

    Declaration
    IFieldConfiguration Required(bool required = true)
    Parameters
    Type Name Description
    System.Boolean required
    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Rows(Int32)

    Sets the number of rows for a textarea to use.

    Declaration
    IFieldConfiguration Rows(int numRows)
    Parameters
    Type Name Description
    System.Int32 numRows

    The number of rows for the textarea

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    SetField(IHtmlContent)

    Sets the field that the field configuration is wrapping so that a call to ToHtmlString() will output the given field.

    Declaration
    void SetField(IHtmlContent field)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Html.IHtmlContent field

    The field being configured

    | Improve this Doc View Source

    SetField(Func<IHtmlContent>)

    Sets a lambda expression to get the field that the field configuration is wrapping so that a call to ToHtmlString() will output the given field.

    Declaration
    void SetField(Func<IHtmlContent> field)
    Parameters
    Type Name Description
    System.Func<Microsoft.AspNetCore.Html.IHtmlContent> field

    A lambda returning the HTML to output

    | Improve this Doc View Source

    SetField(Func<Object, IHtmlContent>)

    Sets the field that the field configuration is wrapping so that a call to ToHtmlString() will output the given field.

    Declaration
    void SetField(Func<dynamic, IHtmlContent> field)
    Parameters
    Type Name Description
    System.Func<System.Object, Microsoft.AspNetCore.Html.IHtmlContent> field

    The field being configured as a templated razor delegate

    | Improve this Doc View Source

    Step(Decimal)

    Sets the stepping interval to use for numeric text controls.

    Declaration
    IFieldConfiguration Step(decimal step)
    Parameters
    Type Name Description
    System.Decimal step

    The stepping interval

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    Step(Int64)

    Sets the stepping interval to use for numeric text controls.

    Declaration
    IFieldConfiguration Step(long step)
    Parameters
    Type Name Description
    System.Int64 step

    The stepping interval

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    WithFalseAs(String)

    Change the label that represents false.

    Declaration
    IFieldConfiguration WithFalseAs(string falseString)
    Parameters
    Type Name Description
    System.String falseString

    The label to use as false

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    WithFormatString(String)

    Uses the given format string when outputting the field value.

    Declaration
    IFieldConfiguration WithFormatString(string formatString)
    Parameters
    Type Name Description
    System.String formatString

    The format string to use

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    WithHint(IHtmlContent)

    Supply a HTML hint to display along with the field.

    Declaration
    IFieldConfiguration WithHint(IHtmlContent hint)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Html.IHtmlContent hint

    The hint markup

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    WithHint(Func<Object, IHtmlContent>)

    Supply a HTML hint to display along with the field.

    Declaration
    IFieldConfiguration WithHint(Func<dynamic, IHtmlContent> hint)
    Parameters
    Type Name Description
    System.Func<System.Object, Microsoft.AspNetCore.Html.IHtmlContent> hint

    The hint markup as a templated razor delegate

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    WithHint(String)

    Supply a string hint to display along with the field.

    Declaration
    IFieldConfiguration WithHint(string hint)
    Parameters
    Type Name Description
    System.String hint

    The hint string

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    WithHintId(String)

    Specify an ID to use for a field hint.

    Declaration
    IFieldConfiguration WithHintId(string hintId)
    Parameters
    Type Name Description
    System.String hintId

    The ID to use

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    WithNoneAs(String)

    Change the label that represents none.

    Declaration
    IFieldConfiguration WithNoneAs(string noneString)
    Parameters
    Type Name Description
    System.String noneString

    The label to use as none

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    WithoutInlineLabel()

    Specify that no inline label should be generated.

    Declaration
    IFieldConfiguration WithoutInlineLabel()
    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    WithoutLabelElement()

    Don't use a <label>, but still include the label text for the field.

    Declaration
    IFieldConfiguration WithoutLabelElement()
    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    | Improve this Doc View Source

    WithTrueAs(String)

    Change the label that represents true.

    Declaration
    IFieldConfiguration WithTrueAs(string trueString)
    Parameters
    Type Name Description
    System.String trueString

    The label to use as true

    Returns
    Type Description
    IFieldConfiguration

    The IFieldConfiguration to allow for method chaining

    Extension Methods

    HtmlAttributesExtensions.ToHtmlAttributes(Object)
    FieldConfigurationExtensions.TabIndex(IFieldConfiguration, Int32)
    FieldConfigurationExtensions.AutoFocus(IFieldConfiguration)
    HtmlContentExtensions.ToHtmlString(IHtmlContent)
    FieldConfigurationExtensions.AsInputGroup(IFieldConfiguration)
    • Improve this Doc
    • View Source
    Back to top © Copyright 2012-2020 MRCollective, Rob Moore, Matt Davies and the contributors to ChameleonForms.