Reputation: 2349
The extjs numberfield has a maxValue property that works well for the spinner (up/down buttons), but doesn't prevent invalid keyboard input. I want to keep the keyboard input, but I want to force correct values and not have to flag it further down the line.
In the onchange handler, I validate newValue against the maxValue and set it back to maxValue, but then I have to use setValue on the control to update it. This fires another onchange event. There is logic based on the onchange event which now gets fired twice.
I'm probably looking for one of two solutions: - 1: be able to update the control value without firing the onchange event - 2: use some inbuilt numberfield property to force entered values back to the max
Upvotes: 0
Views: 1121
Reputation: 970
setRawValue( Object value ) should work with out firing the event, or you can suspend events on the numberfield by
numberfield.suspendEvents( false );//suspend
numberfield.setValue(val); //set value
numberfield.resumeEvents( );//resume events
Upvotes: 1