ChameleonForms/Component/Field.cs
/// <summary>
/// Creates a standalone validation message to be output in a form for a field.
/// </summary>
/// <example>
/// @using (var f = Html.BeginChameleonForm()) {
///     @f.ValidationMessageFor(m => m.PositionTitle)
/// }
/// </example>
/// <typeparam name="TModel">The view model type for the current view</typeparam>
/// <typeparam name="TTemplate">The type of HTML template renderer the form is using</typeparam>
/// <typeparam name="T">The type of the field being generated</typeparam>
/// <param name="form">The form the label is being created in</param>
/// <param name="property">A lamdba expression to identify the field to render the validation message for</param>
/// <returns>The HTML for the validation message</returns>
Creates a standalone validation message to be output in a form for a field.
Creates a standalone validation message to be output in a form for a field .
public static IFieldConfiguration ValidationMessageFor<TModel, TTemplate, T>(this IForm<TModel, TTemplate> form, Expression<Func<TModel, T>> property) where TTemplate : IFormTemplate
        {
            var config = new FieldConfiguration();
            config.SetField(() => form.GetFieldGenerator(property).GetValidationHtml(config));
            return config;
        }
public static IFieldConfiguration ValidationMessageFor < TModel , TTemplate , T > ( this IForm < TModel , TTemplate > form , Expression < Func < TModel , T > > property ) where TTemplate : IFormTemplate { var config = new FieldConfiguration ( ) ; config . SetField ( ( ) => form . GetFieldGenerator ( property ) . GetValidationHtml ( config ) ) ; return config ; }
Creates a standalone validation message to be output in a form for a field.
Creates a standalone validation message to be output in a form for a field .
The HTML for the validation message
The HTML for the validation message
IForm<TModel, TTemplate>
this
property
Expression<Func<TModel, T>>
A lamdba expression to identify the field to render the validation message for
A lamdba expression to identify the field to render the validation message for
form
The form the label is being created in
The form the label is being created in
example
@using (var f = Html.BeginChameleonForm()) {
@f.ValidationMessageFor(m => m.PositionTitle)
}
@using ( var f = Html . BeginChameleonForm () ) { @f . ValidationMessageFor ( m = > m . PositionTitle ) }
typeparam
The view model type for the current view
The view model type for the current view
typeparam
The type of HTML template renderer the form is using
The type of HTML template renderer the form is using
typeparam
The type of the field being generated
The type of the field being generated