[Custom Input Masks] Currency input changes after refresh

Forge Component
(43)
Published on 9 Mar by Marcelo Ferreira
43 votes
Published on 9 Mar by Marcelo Ferreira

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.

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

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



Processing Upload...

Marcelo Ferreira wrote:

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

I have recreated the bug in a simplified application.


After a value has put into this input field. It has to refresh the whole form because it has impact for other stuff. I have settled this to another application and still does the same thing. 


I hope you are able to help me with it, for now I will use the workaround mentioned above.

Eduardo S Sales Rodrigues wrote:

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

I work with a traditional web application. I have tried this option, but I don't know how to make it work fine.

Does it work in traditional web application and when yes, how?


Ralph,

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

Bé Entjes wrote:

Ralph,

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

Like I said in a comment above (sorry that I did not react on your specific point):
I hope you are able to help me with it, for now I will use the workaround mentioned above.

It is still a bug in the input mask in my opinion. So I wanted to replicate it to show what happens. I just hope they can fix it, so other won't encounter the same issues. 


Hi Ralph,

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

Regards,

Marcelo

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.


Processing Upload...

Marcelo Ferreira wrote:

Hi Ralph,

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

Regards,

Marcelo

Thanks for noticing.

It is still trying to upload. It says: processing upload. Also at the first upload I tried.

Let's try again.


Ralph Stemerdink wrote:

Marcelo Ferreira wrote:

Hi Ralph,

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

Regards,

Marcelo

Thanks for noticing.

It is still trying to upload. It says: processing upload. Also at the first upload I tried.

Let's try again.


Wierd it won't let me upload the file.

First time I make use of these Forge component discussions, but it should be possible to upload a .oml file right?


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

Solution

Marcelo Ferreira wrote:

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

Thanks, it works great now! Thanks for the great assistance!