Grid - PopUp Editor - Validation Firing on Open

1 Answer 66 Views
Grid
AP
Top achievements
Rank 1
Iron
Iron
Veteran
AP asked on 27 Jul 2023, 10:41 AM

I've just started using version v2023.2.606 and have a grid with a pop-up editor using an editor template.

This has several required fields (specified in the model), but on opening the window for a new record, the validation error tool tip is shown for the first field (image attached).

This wasn't the behavior in previous versions, which only fired the validation when the update button was clicked.  How can I stop this happening?

The grid is:-


@(Html.Kendo().Grid<InformaticsCommissioningHelper.Models.Rule>()
        .Name("grid")
            .Events(e => e.Edit("onEdit"))
        .Columns(columns =>
        {
            columns.Bound(p => p.ID).Title("ID").Width(120);
            columns.Bound(p => p.RunOrder).Title("Order").Width(120);
            columns.Bound(p => p.Description).Title("Name").Width(600);
            columns.Bound(p => p.LastUpdateDate).Title("Last Updated").Width(150).Format("{0:g}");


            columns.Command(command => { command.Edit(); command.Destroy(); });



        })
            //.ClientDetailTemplateId("subdetailsTemplate")
            .ToolBar(toolbar => toolbar.Create())
            .Editable(editable => editable.Mode(GridEditMode.PopUp))


            .Pageable(p => p.Refresh(true))
        .Sortable()

        .Filterable()

        .DataSource(dataSource => dataSource
            .Ajax()
            .Model(m => m.Id(p => p.ID))
            .PageSize(15)
            .Events(e => e.Error("error"))
            .Read(read => read.Action("RD_Rules", "Rules").Data("antiForgery"))
            .Create(a => a.Action("InsertRule", "Rules"))
            .Update(a => a.Action("UpdateRule", "Rules"))
            .Destroy(a => a.Action("DeleteRule", "Rules"))


            .Sort(s => s.Add(a => a.RunOrder).Ascending())
            )
        )

and the template is:-


@model InformaticsCommissioningHelper.Models.Rule

<div style="width:650px;">

    @Html.ValidationSummary(true)

    @Html.HiddenFor(c => c.ID)

    <p>
        <span class="lbllabel2">
            Name:
        </span>
        @Html.Kendo().TextBoxFor(model => model.Description).Name("Description").HtmlAttributes(new { style = "width:250px", Maxlength = 75 })


        @Html.ValidationMessageFor(model => model.Description)

    </p>


    <p>
        <span class="lbllabel2">
            Order:
        </span>
        <div style="width:150px;" class="float-start">
            @Html.Kendo().NumericTextBoxFor(c => c.RunOrder).Spinners(false)
            @Html.ValidationMessageFor(model => model.RunOrder)
        </div>

    </p>

    <div style="clear:both"></div>
    <p></p>
    <p>
        <span class="lbllabel2">
            SQL:
        </span>
        @Html.Kendo().TextAreaFor(model => model.RuleSQL).Name("RuleSQL").HtmlAttributes(new { style = "width:470px; font-family:Courier New, Courier, monospace"}).Rows(5)
        @Html.ValidationMessageFor(model => model.RuleSQL)

    </p>

    <p>
        <span class="lbllabel2">
            Comments:
        </span>
        @Html.Kendo().TextAreaFor(model => model.Comments).Name("Comments").HtmlAttributes(new { style = "width:470px;"}).Rows(3)
        @Html.ValidationMessageFor(model => model.Comments)

    </p>

 

1 Answer, 1 is accepted

Sort by
0
Anton Mironov
Telerik team
answered on 01 Aug 2023, 10:12 AM

Hello Andrew,

Thank you for the code snippets, the image, and the details provided.

I invested time in order to replicate the described behavior on my side and confirm - you are totally correct.

The first field seems to be blurred on Create of the Grid.

I will continue with my research for the case. In the meantime, try changing the field places in the Model. If the first field is not Required, the described behavior will not be represented.

Attached is the sample project that I prepared for the case.

Kind Regards,
Anton Mironov
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.

AP
Top achievements
Rank 1
Iron
Iron
Veteran
commented on 02 Aug 2023, 09:55 AM

Anton,

Thanks for the response. Unfortunately, re-ordering the form elements to put something that isn't required first isn't possible without it looking nonsensical.

Is it worth me logging a support ticket about this issue?

Anton Mironov
Telerik team
commented on 07 Aug 2023, 07:14 AM

Hi Andrew,

Yes, you are totally correct - indeed, reordering is not the perfect solution.

No need to open a ticket, I will invest further time in order to debug the pointed behavior.

Will come back to you once I have a solution. Thank you for your patience

Best Regards,
Anton Mironov

Anton Mironov
Telerik team
commented on 10 Aug 2023, 07:06 AM

Hi Andrew,

The issue was confirmed as a bug. Here is the GitHub issue that I created for the case:

Feel free to subscribe to the item above for further updates on its status.

Kind Regards,
Anton Mironov

Tags
Grid
Asked by
AP
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Anton Mironov
Telerik team
Share this question
or