primereact
primereact copied to clipboard
InputNumber just perform the onChange when blur
Describe the feature you would like to see added
The current behavior of the InputNumber component has, for me, some "limitations". I would like, when I use the "onValueChange" props, to be able to listen all changes inputted, but it just happens when the input lose it's focus. The current behavior can be noticed in the following codesandbox.
https://codesandbox.io/s/wizardly-greider-ulf2li
Is your feature request related to a problem?
No response
Describe the solution you'd like
I would like the "onValueChange" to listen every change I perform in the input, not just when the input lose it's focus.
Describe alternatives you have considered
No response
Additional context
No response
Hello @augustosnk12 . Don't use the onValueChange attribute. Just use onChange in place of it. That's it. So your input now will look like :
<InputNumber inputId="integeronly" value={value1} onChange={(e) => { setValue1(e.value); console.log("value changed!"); }} />
I had the same issue. Don't know why it doesn't trigger with onValueChange. Might be a bug from the PrimeReact. So, for now just go for onChange.
@amoghsingh Thanks a lot for your help!!! But right now I can even test because I'm too busy (a lot of projects are being coded 😅). When I have time I'll check this out 😉