Results 1 to 2 of 2

Thread: Numberfield, bind, maxValue, autocorrection

  1. #1
    Sencha Premium User
    Join Date
    Nov 2015

    Question Numberfield, bind, maxValue, autocorrection

    Hello there,

    I'm stuck with a numberfield in a simple form. I'm using Ext JS 6.2.0 ( with modern toolkit.
    The idea is to bind the config "maxValue", cause the maxValue changes depending on the record in the form.

    The View looks like:
       xtype: 'selectfield',
       label: 'Select Char',
       options: [{
          text: Character A',
          value: 'A'
       }, {
          text: 'Character B',
          value: 'B'
       bind: {
          value: '{selectValueBound}'
    }, {
       xtype: 'numberfield',
       label: 'Number Value',
       minValue: 1,
       bind: {
          value: '{numberValueBound}',
          maxValue: '{maxValueBound}'
    The ViewModel looks like:
    formulas: {
       maxValueBound: function(get) {
          var char = get('selectValueBound');
          if ( char == 'A')
             return 3;
          if ( char == 'B')
             return 5;
    So binding and switching between different maxValue works fine.
    But when I enter a bigger number than maxValue, Sencha automatically corrects the value to the maximum value.
    Question1: I unterstand this, but is there a possibility to disable the behavior?

    Another behavior of this, is that if I'm using the "numberValueBound" to validate the form (e.g.), the ViewModel is notified by the change the user enters (number bigger than maxValue), but is not notified by the change Sencha does with this autocorrection.
    Question2: Is this a bug? For me it looks like. Or have I to notify the ViewModel manually by catching the change event?

    Thanks in advance!

  2. #2
    Sencha Premium User
    Join Date
    Oct 2015


    I am having a similar issue. I set up some debugging code in my viewmodel formula, and it appears to fire when its bindings change, and the return value (for the maxValue) is what I intend. But until the field gains and loses focus, the field will display as invalid, with the error message still displaying the previous maxValue. It's like the validation lags behind one state if the formula changes.

Similar Threads

  1. numberfield: minValue + maxValue - how to validate?
    By ingo.hefti in forum Sencha Touch 2.x: Q&A
    Replies: 3
    Last Post: 3 Mar 2014, 2:00 AM
  2. NumberField in EditorGridPanel maxValue validation
    By irinarosu in forum Ext 3.x: Help & Discussion
    Replies: 12
    Last Post: 18 Nov 2012, 1:42 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts