Validation ([Required]) not working...

4 posts, 0 answers
  1. Robert Madrian
    Robert Madrian avatar
    154 posts
    Member since:
    Apr 2003

    Posted 23 Nov 2016 Link to this post

    Hi,

    I'm using a AutoComplete in my form (Grid Popup Editor template) and all the Validation works except that on the AutoComplete...(see Picture)

    here is the Code for the AutoCompleteFor:

    <div class="form-group m-xs">
                        <label class="col-sm-2 control-label">Postleitzahl:</label>
                        <div class="col-sm-2">
                            @(Html.Kendo().AutoCompleteFor(m => m.Postleitzahl)
                                .DataTextField("Postleitzahl_ID")
                                .Filter(FilterType.StartsWith).MinLength(1)
                                .NoDataTemplate("Keine Postleitzahl gefunden")
                                .Suggest(true)
                                .Height(300)
                                
                                .DataSource(source =>
                                {
                                    source.Read(read =>
                                    {
                                        read.Action("Postleitzahl_Read", "Standorte")
                                            .Data("onAdditionalData");
                                    })
                                        .ServerFiltering(true);
                                })
                                .Events(e => e
                                    .Select("onPostleitzahlSelect")
                                ))
                            @Html.ValidationMessageFor(model => model.Postleitzahl)
                    </div>

     

    here the part of the model class:

    [Required]
    [StringLength(8)]
    public string Postleitzahl { get; set; }
    [Required]
    [StringLength(65)]
    public string Ort { get; set; }
    [Required]
    [StringLength(255)]
  2. Peter Milchev
    Admin
    Peter Milchev avatar
    258 posts

    Posted 24 Nov 2016 Link to this post

    Hello Robert,

    Please find attached the project we used to recreate your scenario implementing a Grid with required AutoCompleteFor inside a Popup editor. I am afraid that we were unable to observe the described issue on our side.

    Would you please modify the provided project so that it represents exactly your case and reproduces the issue and send it back to us? Thus, we would be able to investigate locally and help you more efficiently.  

    Regards,
    Peter Milchev
    Telerik by Progress
    Telerik UI for ASP.NET MVC is ready for Visual Studio 2017 RC! Learn more.
  3. Robert Madrian
    Robert Madrian avatar
    154 posts
    Member since:
    Apr 2003

    Posted 24 Nov 2016 in reply to Peter Milchev Link to this post

    Hi,

    I cannot use your Project because of missing Kendo.MVC - what Version you are using?

    by the way my project is unter ASP.NET Core and maybe this is the reason why the validation with AutoComplete doesn't work?

    robert

     

  4. Peter Milchev
    Admin
    Peter Milchev avatar
    258 posts

    Posted 25 Nov 2016 Link to this post

    Hello Robert,

    To run the provided project you should remove the existing reference and add a reference to your Kendo.Mvc.dll assembly. You could find the Kendo version used in the lib/KENDOUIMVC folder - 2016.3.1118.440.Trial.

    Since Kendo UI for ASP.NET MVC and Kendo UI for ASP.NET Core are different products, it is important if you use MVC5 or Core.

    As for the AutoComplete for ASP.NET Core, there seems to be an issue with the validation using DataAnnotations. We have logged it as a bug and you could follow this Github issue to know when the it is fixed. As a token of gratitude for reporting the issue, we have updated your Telerik points.

    Regards,
    Peter Milchev
    Telerik by Progress
    Telerik UI for ASP.NET MVC is ready for Visual Studio 2017 RC! Learn more.
Back to Top