Unplanned
Last Updated: 11 May 2022 12:54 by Michelle
Michelle
Created on: 11 May 2022 12:54
Category: Form
Type: Feature Request
4
Add the ability to control the position of the validation summary in the Form Component

I would like to be able to easily define the position of the ValidationSummary in the Form. 

=====

TELERIK EDIT

A possible workaround is to add the ValidationSummary in the <Template> of a <FormItem>.

@using System.ComponentModel.DataAnnotations

<TelerikForm Model="@Employee"
             Width="300px">
    <FormValidation>
        <DataAnnotationsValidator></DataAnnotationsValidator>
    </FormValidation>
    <FormItems>
        <FormItem Field="@nameof(Person.FirstName)" LabelText="First Name"></FormItem>
        <FormItem Field="@nameof(Person.LastName)" LabelText="Last Name"></FormItem>
        <FormItem Field="@nameof(Person.BirthDate)" LabelText="Birth Date"></FormItem>
        <FormItem>
            <Template>
                <TelerikValidationSummary />
            </Template>
        </FormItem>
    </FormItems>
</TelerikForm>

@code {
    private Person Employee { get; set; } = new();

    public class Person
    {
        [Required]
        [MinLength(2)]
        [MaxLength(24)]
        public string FirstName { get; set; } = string.Empty;

        [Required]
        [MinLength(2)]
        [MaxLength(24)]
        public string LastName { get; set; } = string.Empty;

        [Required]
        public DateTime? BirthDate { get; set; }
    }
}

 

0 comments