Ext version tested:
  • Ext 4.1.0
Browser versions tested against:
  • Chrome v20 (Windows)
  • The maskRe for Number fields is only set on initComponent and is never checked again. There are public methods exposed to control the minValue and maxValue for the field but they don't re-evaluate the maskRe.
Steps to reproduce the problem:
  • Create a number field where minValue = 0 and maxValue = Number.Max_Value (Only positive numbers)
  • Notice that you CAN'T type in a negative sign. This is correct.
  • After it has been rendered, programatically set the minValue = -Number.Max_Value and the maxValue = -Number.Min_Value (Only negative numbers)
  • Notice that you still CAN'T type in a negative sign. This is incorrect.
The result that was expected:
  • You should be able to key in negative numbers
The result that occurs instead:
  • You can't enter the negative sign because of the maskRe assigned previously.
Debugging already done:
    initComponent: function () {
       var me = this,
       // Build regexes for masking and stripping based on the configured options
       if (me.disableKeyFilter !== true) {
          allowed = me.baseChars + '';
          if (me.allowDecimals) {
             allowed += me.decimalSeparator;
          if (me.minValue < 0) {
             allowed += '-';
          allowed = Ext.String.escapeRegex(allowed);
          me.maskRe = new RegExp('[' + allowed + ']');
          if (me.autoStripChars) {
             me.stripCharsRe = new RegExp('[^' + allowed + ']', 'gi');

Possible fix:
  • Change the setMinValue and setMaxValue to re-create the mask or make the maskRe not private?
Operating System:
  • Win7 Pro 64bit