Unplanned
Last Updated: 29 Jan 2024 11:12 by Sarah
Sarah
Created on: 29 Jan 2024 11:12
Category: DropDownList
Type: Bug Report
0
Validation error message shown for a valid DropDownList in a Form

Bug report

The DropDownList is incorrectly marked as invalid, when another field of the model is invalid.

Reproduction of the problem

Sample project attached.
MVCFormValidation.zip

  1. Run the project
  2. Click the submit button. It submits the form and in the submit action a model error is added to a specific field of the model: ModelState.AddModelError("NumberOfShares", "Number not in the expected range");

Current behavior

Two validation errors appear after the form submission: one for the NumberOfShares field and a second one for the Country.Id field, for which a DropDownList editor is used.

Expected/desired behavior

A validation error appears only for the NumberOfShares field.
Note that if no editor is specified for the Country.Id field (instead of using a DropDownList editor), e.g.,

	i.Add()
	    .Field(f => f.Country.Id)
	    .Label(l => l.Text("Country"));

no validation error message is shown for Country.Id.

Environment

  • Kendo UI version: 2023.3.1114
  • jQuery version: x.y
  • Browser: [all]
0 comments