Index: src/webapp/components/uiOptions/js/UIOptions.js =================================================================== --- src/webapp/components/uiOptions/js/UIOptions.js (revision 7164) +++ src/webapp/components/uiOptions/js/UIOptions.js (working copy) @@ -34,16 +34,14 @@ var slider = that.locate("slider").slider(sliderOptions); textfield.change(function () { - if (this.value < that.min) { - this.value = that.min; - } else if (this.value > that.max) { - this.value = that.max; - } - - if (that.isInRange(this.value)) { + if (that.isValid(this.value)) { + if (!that.isInRange(this.value)) { + this.value = (this.value < that.min) ? that.min : that.max; + } slider.slider("value", this.value); that.updateModel(this.value, this); - } else { + } + else { // handle invalid entry this.value = that.model; } @@ -82,6 +80,14 @@ that.isInRange = function (value) { return (value >= that.min && value <= that.max); }; + + /** + * Tests if a value is a valid number. + * @param {Object} value + */ + that.isValid = function (value) { + return !(isNaN(parseInt(value, 10)) || isNaN(value)); + }; /** * Updates the model if it is in range. Fires model changed