101
Views
13
Comments
Solved
[Custom Input Masks] Currency input changes after refresh
Question
Forge component by Sara Gonçalves
46
Published on 23 Jul 2020

Whenever I use the currency input mask to create a European view on my page, he changes the currency variable with decimals to a full number.
5,90 will become 59,00

5,09 will become 509,00

5.90 will become 59,00

5.09 will become 509,00

I can see that it changes because of an ajax refresh on that input value and he also saves it with the wrong value from above.

I have set the properties on the values like below and like you see above: I just tryed every way to put in a currency.

I hope someone can help me solve the problem so the 5,90 will stay that way.

mvp_badge
MVP
Rank: #16
Solution

Hi Ralph,

With your example I was able to reproduce the problem. In attachment a version of Custom Input Mask that solve your problem. 

When I have some more time I will include it on the component. Just leaving it here so you don't stay blocked with this problem.

Regards,

Marcelo

CustomInputMasks.oml

mvp_badge
MVP
Rank: #16

Hi Ralph,

Are you using the latest version of the component? Because I wasn't able to replicate this. If not, update it and test it again. If you are using the latest version, can you plz create a simple example and share with me.

Regards,

Marcelo

Rank: #14119

I have exact the same issue.

Just solved it by dividing the input by 100 just before updating


Hi, Ralph.

I had this problem when I went to use the mask in react, so I converted it to text as follows in OnInitialize:

If(Index(Decimal,".",searchFromEnd:True)=-1,DecimalToText(Decimal)+".00",
    If(Mod(Decimal*100,10)=0,DecimalToText(Decimal)+"0",
        DecimalToText(Decimal))) 

And I used the Module, where I created it, I made this function available:

Mask BR - React



Rank: #14119

Ralph,

Can you not just divide the value before the ajax refresh?

mvp_badge
MVP
Rank: #16

Hi Ralph,

Your example didn't upload. Can you try to upload it again.

Regards,

Marcelo

Rank: #14119

Ok, I see what you mean. Good point.

I don't have an ajax refresh, I just save the amount given as input. The result is the same as you described. the value is multiplied by 100 and then stored in the database. After the save the screen is refreshed and the wrong amount is displayed. Saving it again will add another two zeroes.

Must be really easy to replicate and to fix, i hope.


mvp_badge
MVP
Rank: #16
Solution

Hi Ralph,

With your example I was able to reproduce the problem. In attachment a version of Custom Input Mask that solve your problem. 

When I have some more time I will include it on the component. Just leaving it here so you don't stay blocked with this problem.

Regards,

Marcelo

CustomInputMasks.oml