Skip to content

Latest commit

 

History

History
37 lines (32 loc) · 1.13 KB

File metadata and controls

37 lines (32 loc) · 1.13 KB
title description api_reference slug
Validator API
API Index | Validator
true
api_validatordirective

Validator

The Validator receives its options through the v-kendo-validator directive. All available options for the Kendo Validator widget are available as options for the directive.

<form id="ticketsForm" ref="myForm" v-kendo-validator="setup" @submit.prevent="onSubmit">
 ...
</form>

...

new Vue({
    data: {
        setup: {
            rules: {
                greaterdate (input) {
                    if (input.is("[name='RetireDate'") && input.val() != "") {
                        var date = kendo.parseDate(input.val()),
                                            otherDate = kendo.parseDate(kendo.jQuery("[name='HireDate']").val());
                        return otherDate == null || otherDate.getTime() < date.getTime();
                    }
                    return true;
                }
            },
            messages: {
                greaterdate: 'Retire date should be greater than Hire date'
            }
        }
});