This is a migrated thread and some comments may be shown as answers.

Read-only fields not being validated

1 Answer 601 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
eduardo
Top achievements
Rank 1
eduardo asked on 13 Dec 2012, 11:29 AM
Hello.
I just updated to the latest version of Kendo UI for ASP.NET MVC (Q3 2012).
I noticed that some text boxes with both "required" and "readonly" attributes are not being validated anymore.
Here's what I have:

@{
   var materialHtmlAttributes = new Dictionary<string, object>();
   materialHtmlAttributes.Add("class", "k-textbox");
   materialHtmlAttributes.Add("readonly", "readonly");
   materialHtmlAttributes.Add("data-bind", "value: item.Material.Description");
   materialHtmlAttributes.Add("validationMessage", "The Material field is required.");
   materialHtmlAttributes.Add("required", "required");
}
@Html.TextBox("materialInputText", null, materialHtmlAttributes)

With the previous version of Kendo UI, this worked fine and the field was validated correctly, even being read-only. Now, this does not work anymore, the field is no longer validated. If I remove the read-only attribute, then it works.
It is important that the field remains read-only, because the value is set according to a selection made by the user in a list.

Is there a reason for this to not work anymore? Do I have to make some adjustments?

Thank you.

1 Answer, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 15 Dec 2012, 10:41 AM
Hello Eduardo,

The change is by design and can be seen in the release notes -  Read-only inputs should not be validated. If you need the readonly input to be validated I can suggest to use a custom rule or override the required rule.

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
General Discussions
Asked by
eduardo
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or