NumericTextBox .value() reads old value onLeave

3 posts, 1 answers
  1. co-logic
    co-logic avatar
    14 posts
    Member since:
    Jun 2006

    Posted 22 Nov 2017 Link to this post

    The numericTextBox control gets the old value, if one inputs a new number directly in the textbox field and then leaves the controls. It works only correctly, if the value is selected by spin buttons. I created a sample:

    http://dojo.telerik.com/aTuBI

    Am I doing something wrong?

  2. Answer
    Georgi
    Admin
    Georgi avatar
    188 posts

    Posted 24 Nov 2017 Link to this post

    Hello Christian,

    Thank you for the provided sample. I have examined it and noticed that the event handler is attached to the change event of the input element, not to the Kendo NumericTextBox.

    e.g.
    var numeric = $("#num").kendoNumericTextBox(); //this method initializes the widget but does not return the instance
    numeric.bind("change", function (e) { alert("Value: " + $("#num").data("kendoNumericTextBox").value()) });

    Should be:
    var numeric = $("#num").kendoNumericTextBox().data('kendoNumericTextBox');
    numeric.bind("change", function (e) { alert("Value: " + $("#num").data("kendoNumericTextBox").value()) });

    I have modified the provided sample and now the correct value is displayed:



    Regards,
    Georgi
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. co-logic
    co-logic avatar
    14 posts
    Member since:
    Jun 2006

    Posted 24 Nov 2017 in reply to Georgi Link to this post

    Great! Thank you
Back to Top