You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's two approaches you can take to allow users to set a maximum value in finput:
Increase the flexibility of the range option to allow specifying a number of digits a value can be upto.
Adding a setMaxValue option to set a specific number to be the maximum value (e.g. 175,200.00)
Although option 2 provides more choice for end-users, it also comes with a larger increase in complexity. For example, setting a specific maximum value could conflict with other options. You could set a max value that has more decimal digits than what is allowed in range, and you could also set a maximum value that's negative while setting range to be positive numbers only. This is on top of having to perform a value greater-than check before allowing each user input to go through, be it for copy paste or a simple keypress.
Some of this added complexity is also passed down onto the end-user who may not understand why their input is being rejected. More users can deduce when their non-numeric keypress is rejected within a numeric field. On the other hand, despite entering a valid number a keypress could be rejected due to the value reaching some potentially non-obvious (to the user) maximum value.
As a result, I think it'd be nice to have option 1 implemented. I feel it would add support for the vast majority of real-world use cases out there as a bonus.
As a dev i want to be able to stop the user setting the value of finput above a configured value of my choice.
I think i can do this outside of finput using some checks and setValue but could be nicer to have a config option similar to scale.
@chrisprice is this something you want out of finput for its long-term maintainability?
The text was updated successfully, but these errors were encountered: