override validationMessage on datapicker input

2 posts, 0 answers
  1. Federico
    Federico avatar
    6 posts
    Member since:
    Nov 2017

    Posted 13 Dec 2017 Link to this post

    I have a datapicker:

     

    <label class="required label-date" for="a-c">StartDate</label>
            <input id="a-c" class="k-datepicker" name="Date" required validationMessage="Write {0}" data-role="datepicker" data-bind="value: start, events: {change: OnChangeStart}" />

     

    and a kendo validator with datapicker rules:

     

    var validator = $("#form").kendoValidator({
             rules: {
               datepicker: function(input) {
                 if (input.is("[data-role=datetimepicker]")) {
                   return input.data("kendoDateTimePicker").value();
                 } else {
                   return true;
                 }
               }
             },
             messages: {
               datepicker: "Please enter valid date!",
               required: " Required input"
     
             }
           }).data("kendoValidator");

     

    validationMessage override the datapicker message.

    I would not like to delete the Validation Message.

     

     

     

           

  2. Georgi
    Admin
    Georgi avatar
    188 posts

    Posted 14 Dec 2017 Link to this post

    Hi Federico,

    The described behavior is expected since the input element has required attribute. This triggers the required validation first and as it fails no other validation is triggered. 

    Remove the required attribute and validation should display the correct message:



    Regards,
    Georgi
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top