Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KendoUI Validate Numeric Textbox

Tags:

kendo-ui

The KendoUI validation does not work with kendo-numeric-textbox. I get the following error. "An invalid form control with name='amount' is not focusable. "

See example below. Try submit and see error in browser console.

http://plnkr.co/edit/pXpXexPq3u9xAzzpKR8Y?p=preview

I´m trying to get required popup "Please fill out this field" with the Kendo numeric textbox.

Can anyone help?

like image 395
Kjartan Valur Þórðarson Avatar asked Jun 13 '26 17:06

Kjartan Valur Þórðarson


1 Answers

Seems to be some strange issue with hidden fields using the kendoNumericTextBox.

I was able to get it to work using the kendo validator: [See here]

There's also an interesting article [Here]

Updated Code:

$(document).ready(function () {


   $("#amount").kendoNumericTextBox();


    var validator = $("#testForm").kendoValidator().data("kendoValidator"), status = $(".status");
    $("form").submit(function(event) {
                    event.preventDefault();

                    if (validator.validate()) {
                        status.text("Valid")
                            .removeClass("invalid")
                            .addClass("valid");
                    } else {
                        status.text("Not Valid")
                            .removeClass("valid")
                            .addClass("invalid");
                    }
                });

});
like image 64
Rick S Avatar answered Jun 18 '26 00:06

Rick S



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!