Open IvanDanchev opened 7 months ago
Issue appears because by the time we MVVM bind the form, the drop down data is not yet available on the client. By default the list will skip assigning the value of the input, if the data is not yet bound:
Thus, during validation, the input is still empty, and the required validation fails.
A possible fix would be to assign the input value even though the data is not yet on the client. However, jQuery team should validate that.
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
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.,
no validation error message is shown for Country.Id.
Environment