Invalid validation message in Date/Time Picker

3 posts, 0 answers
    3 posts
    Member since:
    Dec 2008

    Posted 29 Oct 2015 Link to this post

    We are experiencing an issue with the Kendo ui datetime picker in our MVC Sitefinity application. The issue manifests itself only in IE after a workaround JavaScript function has been applied. The application's default culture is set to fr-CA however in the view the date format needs to be fr-FR. If submit is clicked and the text area of the datetime picker is empty the validation message as set on the model property is displayed correctly, however if any non valid text is entered into the text area then the validation message displayed is: "DateDebut is not a valid date". The workaround function replaces the data-val-date attribute displaying the correct validation message in the French language and as stated works in all browsers but IE.  As show below the kendo culture is set to fr-FR.


    $(document).ready(function () {
       $(function () {
            $("input[data-val-date]").each(function (index, el) {
                var re = new RegExp("The field (.*?) must be a date");
                var string = $(this).attr("data-val-date");
                var m = string.match(re);
                if (m != null && m.length > 1) {
                    $(this).attr("data-val-date", string.replace(m[0], "Le champ " + m[1] + " doit être une date (ex: 14/06/2015)"));
       <div class="form-group" style="width: 100%">
            @Html.LabelFor(m=> m.DateDebut, new { @class = "control-label col-sm-4" })
            <div class="col-sm-3">
                @Html.Kendo().DatePickerFor(m => m.DateDebut).Format("{0:dd/MM/yyyy}").HtmlAttributes(new {@style="width:150px;"})
                @Html.ValidationMessageFor(m => m.DateDebut)



  2. Georgi Krustev
    Georgi Krustev avatar
    3725 posts

    Posted 02 Nov 2015 Link to this post


    My assumption is that the applied change is not honored in IE. Unfortunately, I am not sure what exactly could cause the issue in this particular case. I would suggest you try to change the DatePicker widget with regular HTML Input element. If the issue still persists, then the problem is not related to UI for ASP.NET MVC / Kendo UI, but the issue caused by the used client validation framework together with the IE browser.

    If the issue is related to the DatePicker widget, please send us a regular ASP.NET MVC demo, as it is not related to Sitefinity, that replicates the problem. Thus we will be able to review the case locally and advice much faster.

    Georgi Krustev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
    3 posts
    Member since:
    Dec 2008

    Posted 04 Nov 2015 in reply to Georgi Krustev Link to this post

    Hi Georgi,

    I did replace DatePicker widget with a regular HTML Input element and our function to replace the English validation text with French text works. I was however able to find a solution for the DatePicker validate by adding a javascript library which overrides ​Kendo validation ​messages at the prototype level per chosen language. ​Found @ Kudos to the developer. Our original function is still required when using Chrome, but in IE it did the trick.



Back to Top