Open eliasfank opened 4 years ago
The problem is that it's unmasking and masking with ,
as the decimal separator. I also don't like this behavior, but I fixed it in my application by doing some replaces. Because this works correctly:
Masking: 3212,55
=> R$ 3.212,55
Unmasking: R$ 3.212,55
=> 3212,55
There seems to be a bug with the original onBeforeMask
function. So, you can do it works simply overriding this function. Check my fiddle: https://jsfiddle.net/diegomagikal/rcgton14/1/
I'm trying to use the Inputmask for a BRL money field. It is working correctly when the user types the value on the field, but when the field has an initial value or when a value need to be set on the field, it goes wrong.
Here https://jsfiddle.net/eafank/f0phu5Lj/33/ is how I configured the mask and a field with the problem. Also, another field with a hacky solution. When the value is set as a Number, the masked value is correct, but with a string, it does not work as expected. This issue #1418 shows that creating the onBeforeMask and returning the value also works, and it really works. But, is this still the best solution?
OS: All
Browser: All
Inputmask 5.0.3
Maybe I'm forgetting something or there is another way to achieve the following behavior: Masking:
3212.55
=>R$ 3.212,55
Unmasking:R$ 3.212,55
=>3212.55
I really appreciate any help on my solution or to find the bug in the src.