Check KendoUI DatePicker when multiple date fields are on the page

I am looking to check the date fields on a page, which is simple (see this JSBin ). BUT, when a page has several date fields on the page, everything starts to get stupid ...

Watch this JSBin and play with invalid dates.

The invalid message does not know which input to bind, causing error messages on the wrong inputs. Is there a way to invoke the correct input field?

0
source share
1 answer

, , , , . :

$(".datepicker").kendoDatePicker();
$(".datepicker").kendoValidator({
    rules   : {
        //implement your custom date validation
        dateValidation: function (e) {
            console.log("e", e);
            var currentDate = Date.parse($(e).val());
            //Check if Date parse is successful
            if (!currentDate) {
                return false;
            }
            return true;
        }
    },
    messages: {
        //Define your custom validation massages
        required      : "Date is required message",
        dateValidation: "Invalid date message"
    }
});

JSBin

+2

All Articles