Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputNumber not accepting decimal input with mode="decimal" and minFractionDigits="0" #1881

Closed
Gordo5556 opened this issue Dec 13, 2021 · 5 comments

Comments

@Gordo5556
Copy link

[X ] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primevue/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=110

Current behavior
When entering values into with
mode="decimal"
:minFractionDigits="0"
:maxFracionDigits greater than 2

It is not possible to enter enter any decimal values into the InputNumber box.

Expected behavior
After pressing the period button, '.' , I would expect the decimal separator to be added and the next numbers types should then be the decimal numbers.

Minimal reproduction of the problem with instructions
Add a InputNumber box such as:

Then attempt to enter 123.45. The InputNumber box will not allow decimals.

  • Vue version: 3.X
    "vue": "^3.0.11",

  • PrimeVue version: 3.4.X
    "primevue": "3.4.0",

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
    Firefox 95.0

@tugcekucukoglu
Copy link
Member

<InputNumber mode="decimal" /> just allows integers and to define fractions 'minFractionDigits' property is required. So <InputNumber mode="decimal" :minFractionDigits="0" /> accepts only integer.

@dashavoo
Copy link

dashavoo commented Feb 3, 2022

Hi @tugcekucukoglu - your description explains the reason for the issue described, but I think it is still an issue.

There are cases where you do not want to show a decimal place by default, but still allow the user to enter one. I am a little confused because #1136 described the requirement, and a milestone was added, but for InputNumber is still to be integer only and minFractionDigits=0 does not add optional fraction digits.

@Gordo5556
Copy link
Author

Thank you @dashavoo, that is exactly the problem I am seeing. It seems like this has been mentioned in a couple different places but has not been addressed yet.

@DaveBruwer
Copy link

I agree with above sentiment. I want to be able to add a decimal, but I don't want to be forced to display ".00" all the time.
I believe the default behaviour should be allowing decimals but not displaying ".00".

@webfiltered
Copy link

This is the first search result, so commenting for others.

I get the desired completely-optional decimal place behaviour with:

<InputNumber mode="decimal"  max-fractional-digits="3" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants