I'll go straight to the questions:
If the DatePicker widget is known to have the more correct value, why would it not be submitted rather than the less correct textbox?
Basically this is not possible, because the HTML form is not aware that the widget actually exists. It could only access the values of the native elements and submit them. This is why it is up to the developer to validate the state of the fields.
Why is the textbox value not kept in sync with the widget value, especially since you are already updating the widget to null for bad values?
This behavior is by design and the goal is to improve user experience. When the client validator notifies the user that the entered value is not valid, one will be able to observe the incorrect value as it is still in the input element.
Is there a way to use the DatePicker widget with a read-only <span> rather than the not always correct textbox?
Yes, this could be achieved by adding the readonly
property to the input, after the widget is initialized. This way only the input element will be readonly. If the property is set during initialization e.g. via the HtmlAttributes method, the whole widget will be considered as readonly (including the dropdown).
Regarding the article, that I provided in the previous post, it was intended to demonstrate a general approach of adding client validation. The snippet, that you are referring to, emphasizes the fact that the Range attribute is more suitable for number validation. Values of any other type are passed as strings and then parsed to the specific type. Furthermore the attribute accepts only constants as values for the min and max.
As for the last question, there is no MVC Wrapper for the Kendo UI Validator. You could take a look at the following documentation page
, which demonstrates how to use the Validator with data annotations. It also contains an example
, demonstrating how to implement a custom attribute, which is a possible approach in the current scenario.
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.