primereact icon indicating copy to clipboard operation
primereact copied to clipboard

InputNumber just perform the onChange when blur

Open augustosnk12 opened this issue 2 years ago • 2 comments

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

augustosnk12 avatar Jun 21 '22 19:06 augustosnk12

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 avatar Aug 24 '22 10:08 amoghsingh

@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 😉

augustosnk12 avatar Aug 24 '22 12:08 augustosnk12