127
Views
2
Comments
[Input Mask React]  can't erase value of 0 in currency mask
inputmask-react
Reactive icon
Forge asset by João Barata
Application Type
Reactive

Hi,

in my use case, users must be able to enter any numeric value, including the value of 0 Euro, but must also be able to make the input empty, so no value.

I'm using this forge component with an input of type text, everything works as I want, except when trying to go from a filled value of zero to not filled.  Using either delete, or backspace don't get rid of the value 0.

In comparison, when I have a value other than 0 filled, and then go to the input and press delete key or backspace key, gives value of "" to underlying variable, but not when initial value is 0.

So 

any value other than 0 to "" works

"" to any value other than 0 works

"" to value 0 works

value 0 to "" does not work

Dorine

UserImage.jpg
Nicolas da Silva

Hi Dorine,

Since this was quite some time ago I do not know if this is still a valid issue for you. However, with a few changes to the script (Also from the help of Mostafa Othman and his solutions in https://www.outsystems.com/forums/discussion/77493/input-mask-react-currency-mask-has-pre-defined-placeholder-as-0/) plus a change to the placeholder value from the i.default.extendAliases({numeric:{  from "0" to "" (There is no longer the issue of having to forcefully click outside the input box to view an empty input), hopefully this should help solve your issue.

Please find the modified JS attached (In .txt format)


Best regards,


Nicolas da Silva

inputmask_min.txt
2025-01-09 14-56-57
IQ78

Hi there,

i tried to clone, but there is an error: inputmask is not defined.

And in the new component when i search the " i.default.extendAliases({numeric:{ ",there is none.

How to enable blank (not 0 ) using this mask  (number)? 

regards

regards

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.