Numeric field, setting min/max values and validation?

Tags: #<Tag:0x00007f51daee7f40>

I’m using the numeric field type on a column, and I’d now like to be able to set a min/max value.
for example, I may set min=10, max=100. If user enters number outside this range, it would show up in error condition.

Is this possible with the current numeric field type?

Hi @mhennessy7

You can write a simple validator, like so

 validator: function(value, callback) {
           if (value < 100 && value > 10) {
             callback(true);
           } else {
             callback(false);
           }
}

Demo: https://jsfiddle.net/xvn1s4pt/1/
Then before the callback(false) you can add any additional needed logic (like for example, adding a comment that the value doesn’t meet the range).

Let me know if that meets your requirements.