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

NumericTextBox .value() reads old value onLeave

2 Answers 615 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
co-logic
Top achievements
Rank 1
co-logic asked on 22 Nov 2017, 08:05 AM

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 Answers, 1 is accepted

Sort by
0
Accepted
Georgi
Telerik team
answered on 24 Nov 2017, 07:58 AM
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.
0
co-logic
Top achievements
Rank 1
answered on 24 Nov 2017, 09:07 AM
Great! Thank you
Tags
NumericTextBox
Asked by
co-logic
Top achievements
Rank 1
Answers by
Georgi
Telerik team
co-logic
Top achievements
Rank 1
Share this question
or