3 Answers, 1 is accepted
0
Hi Jaanus,
To achieve the desired outcome, handle the close event:
In the event handler, based on a condition, prevent the default behavior and reset the invalid date. For example:
Kind regards,
Tsvetomir
Progress Telerik
To achieve the desired outcome, handle the close event:
In the event handler, based on a condition, prevent the default behavior and reset the invalid date. For example:
Kind regards,
Tsvetomir
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jaanus
Top achievements
Rank 1
answered on 07 Jan 2019, 11:36 AM
The users usually change the value by just writing the value, not opening the datepicker.
How can I handle it then?
0
Hi Jaanus,
If you would like to have an input which restricts the user from typing in invalid data, then you can make use of the DateInput setting of the Kendo UI DatePicker.
https://docs.telerik.com/kendo-ui/api/javascript/ui/datetimepicker/configuration/dateinput
This would show the user what is the pattern for the date and it will automatically restrict them from submitting invalid data.
It is important to point out that the change event of the DatePicker is triggered when the date from the calendar is changed, rather than on the change of the input. There is an option to attach jQuery event handlers to the Kendo UI widgets, but even on the keypress event, it would be too late to cancel the changes because the value will be already in the input.
Let me know in case additional questions arise.
Kind regards,
Tsvetomir
Progress Telerik
If you would like to have an input which restricts the user from typing in invalid data, then you can make use of the DateInput setting of the Kendo UI DatePicker.
https://docs.telerik.com/kendo-ui/api/javascript/ui/datetimepicker/configuration/dateinput
This would show the user what is the pattern for the date and it will automatically restrict them from submitting invalid data.
It is important to point out that the change event of the DatePicker is triggered when the date from the calendar is changed, rather than on the change of the input. There is an option to attach jQuery event handlers to the Kendo UI widgets, but even on the keypress event, it would be too late to cancel the changes because the value will be already in the input.
Let me know in case additional questions arise.
Kind regards,
Tsvetomir
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.