p-inputNumber keyup and keydown causing number value to increment

UI Components for Angular
Post Reply
whynogooglelogin
Posts: 1
Joined: 17 Sep 2021, 11:55

17 Sep 2021, 12:06

How can I stop this?

If I attempt to preventDefault in the (keydown) event it doesn't work, because the event is bound to the p-inputNumber element, rather than the underlying input element.

I'm sure there's some obvious thing that I've missed, but I can't find it anywhere.

Thanks.

dominik.dujava
Posts: 1
Joined: 04 Feb 2022, 16:49

04 Feb 2022, 17:18

Hi,

did you manage to solve this? have similiar request - stop up/down arrow keys on p-innputNumber.

jamesskurray
Posts: 10
Joined: 26 Jul 2017, 08:17

11 Feb 2022, 05:55

There is an issue to trigger an update with every entry, there is a pull request for this.

There is no obvious solution to this yet.

splauer1us
Posts: 1
Joined: 18 Apr 2022, 19:54

25 Apr 2022, 17:15

Setting step="0" on the p-inputNumber will stop the increment/decrement with the arrow-up and arrow-down

<p-inputNumber
[(ngModel)]="rate"
mode="currency"
currency="USD"
locale="en-US"
(keydown)="keypress($event)"
step="0"
></p-inputNumber>

Cristiano Meneses
Posts: 2
Joined: 25 Apr 2022, 18:58

27 Apr 2022, 14:23

Formatação em Real - BR
<p-inputNumber mode="currency" currency="BRL" locale ="pt-BR"></p-inputNumber>

justcoder
Posts: 5
Joined: 22 Dec 2021, 17:22

04 Nov 2022, 14:16

The 'Step' comment worked for me but needed to go inside []:
<p-inputNumber [step]="0" id="someInput" name="someInput" mode="currency" currency="GBP" placeholder="£0.00" formControlName="someInput"></p-inputNumber>

Thanks

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 8 guests