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

clearing out value (backspace) with minimumValue defined #699

Open
stepet80 opened this issue Jul 29, 2020 · 7 comments
Open

clearing out value (backspace) with minimumValue defined #699

stepet80 opened this issue Jul 29, 2020 · 7 comments
Labels
💁‍♂️ Need reporter feedback A response is needed from the reporter before being able to do more

Comments

@stepet80
Copy link

Current behavior:

  • When using the minimumValue we cannot clear out the number with for example backspace

Expected behavior

  • The value should be cleared because NULL or empty is not a real number

Steps to reproduce the problem

  • Use AutoNumeric 4.6.x
  • use property minimumValue: 1
  • type in a number for example 1
  • do backspace
  • the value is not cleared and stays on 1

This works well with version 4.5.x .!

@melloware
Copy link
Contributor

melloware commented Jul 29, 2020

Isn't that this bookmarked issue: #543 ???

@stepet80
Copy link
Author

That doesn't help. The solution they propose is to allow to put invalid values and mark the value as invalid.
We just want the old behavior back... Null/empty would not be seen as lower than any minvalue...

@melloware
Copy link
Contributor

I know i am just pointing out that the developer pinned that post specifically because of issue reports like this one...

@AlexandreBonneau
Copy link
Member

Indeed, I did not unpin #543 since 1) it was a long awaited feature request, and 2) it changes quite a bit the philosophy of AutoNumeric where the value was always supposed to be valid.

So, apart if I did not understood the issue, I think it's moot since you can indeed repeat the steps and clear the field value when the minimumValue is set to 1. You just have to specify the overrideMinMaxLimits: 'invalid' option (by default the behavior is not changed, as in the value is always kept valid).

Please checkout the reproducible test case.

@AlexandreBonneau AlexandreBonneau added the 💁‍♂️ Need reporter feedback A response is needed from the reporter before being able to do more label Aug 2, 2020
@stepet80
Copy link
Author

stepet80 commented Aug 3, 2020

But if I specify overrideMinMaxLimits the user can visually enter anything below it.
For example in the reproducible test case the user can also enter 0. Visually the behavior has changed.

@fanste
Copy link

fanste commented Feb 17, 2021

A valid usecase where clearing the input should be allowed while the minimum is set to > 0 is the required attribute. If p:inputNumber required="false" minValue="1" Then the value should be >= 1 if any value is provided.

This is currently not possible and always requires a workaround/hack.
That means: do not set minValue (or set it to 0) and add a server side validator like f:validateLongRange minumum="1".

This is really ugly because that always required a p:ajax event="blur" or something like that to give instant feedback to the user

@ollie10
Copy link

ollie10 commented Apr 22, 2022

Hello, any solution for this problem? It seems was reported already in 2018, I have read all the topics but still didn't find a solution

Imagine I have two autonumeric in a page with two prices I set one and another no, I was wrong and I want to clear the one set and set the one unset.

Since both of them where empty at the beggining why I'm not able to come back to that stage? It's weird...
An option could be to use some options like defaultValueOverride to reset it to this value if it is set to empty, but the impossibility to clear a value it's a complete stopper to use the library...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💁‍♂️ Need reporter feedback A response is needed from the reporter before being able to do more
Projects
None yet
Development

No branches or pull requests

5 participants