This is a migrated thread and some comments may be shown as answers.

Merge Validation Rules After Initialization

1 Answer 172 Views
Validation
This is a migrated thread and some comments may be shown as answers.
jwize
Top achievements
Rank 1
jwize asked on 25 Mar 2013, 07:53 AM
Initialization of the Kendo validator in shared file
I am initializing my validator without rules from a shared file. I need to then add some rules for a separate file only when that file is used.
var validatable = form.kendoValidator({
    validateOnBlur: false
}).data("kendoValidator");

I need to add rules in a separate file that isn't shared
The following code needs to be added from the separate file
{
            rules: {
                radio: function(input) {
                    if (input.filter("[type=radio]") && input.attr("required")) {
                        return $("form").find("[name=" + input.attr("name") + "]").is(":checked");
                    }
                    return true;
                }
            },
            messages: {
                radio: "Please select a status"
            }
        }

How can I merge these rules to the existing validator validation code when that files is included?

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 26 Mar 2013, 10:38 PM
Hello Jamie,

I am afraid that what you would like to achieve is not supported out of the box. Custom validation rules are defined once, during the initialization of the component. It is possible only to customise the existing validation messages by attaching data-[rule]-msg attribute to the corresponding input elements.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Validation
Asked by
jwize
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or