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

Validator on large number of radio inputs

1 Answer 66 Views
Validation
This is a migrated thread and some comments may be shown as answers.
Lovro
Top achievements
Rank 1
Lovro asked on 21 May 2014, 08:54 AM
Hello,

the problem is validator is really slow(beacuse i have about 400 radio inputs - 130 radio button groups). Here is the code of the custom rule of the validator:

$("#testWizard").kendoValidator({
        rules: {
            radio: function (input) {
                     //if type radio and required attribute on the input
                if (input.is("[type=radio]") && input.attr("required")) {
                          //check if any radio button is selected from the radio button group
                    return $("#testWizard").find("[name=" + input.attr("name") + "]").is(":checked");
                }
                return true;
            }
        },
        messages: {
            radio: "Choose one of the items"
        }
    });

The best solution would be that validation code breaks when the first validation error is found. But i don't know how to achieve this.
Maybe any other suggestions?

Thanks

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 22 May 2014, 12:32 PM
Hello Lovro,

The performance that you see is somewhat expected. Going through your form with 400+ DOM elements is a slow process in general and I am afraid that no optimization could be made.

As for the breaking when the error is found - currently there is not such feature, the Kendo UI Validator, work for all elements in the container, so it will show all the errors for every single fields that fails the validation.

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