$(document).ready(function() {
// create NumericTextBox from input HTML element
$("#numeric").kendoNumericTextBox();
var ntb = $("#numeric").data("kendoNumericTextBox");
//hacking, trigger event when out of range
ntb._adjust = function(value) {
var that = this,
options = that.options,
min = options.min,
max = options.max;
if (value === null) {
return value;
}
element = this.element;
var triggerEvent = function() {
var evtData = { value: value, max: max, min: min };
setTimeout(function() {
element.trigger("outOfRange", evtData);
}, 1);
};
if (min !== null && value < min) {
triggerEvent();
value = min;
} else if (max !== null && value > max) {
triggerEvent();
value = max;
}
return value;
};
$("#numeric").bind("outOfRange", function(e, data) {
if (data.value > data.max)
alert("Value " + data.value + " is greater than Max: " + data.max);
else if (data.value < data.min)
alert("Value " + data.value + " is less than Min: " + data.min);
});
});