[Input Masks Mobile] Input Mask Mobile - Loading different values than the recorded ones

[Input Masks Mobile] Input Mask Mobile - Loading different values than the recorded ones

  
Forge Component
(7)
Published on 2017-11-15 by Labs
7 votes
Published on 2017-11-15 by Labs

Hello everyone,

After retrieving values from the database, the decimal mask is building incorrectly.

For example, in the database i have a decimal number as 22.7 and the mask settings with 2 decimal digits, the mask builds it as '02,27' instead of '22,70'.  The only way i can get it to work properly is to use 2 decimaldigits greater than 0 (22,73 for example).

Any ideas how to solve this?

Cheers,

Rafael Battistelo

Hello Rafael,

We were able to replicate the issue and we will add it to our backlog.

During our testing we found a possible workaround:

  • The issue is occurring because the platform considers the decimal value 22.70 as 22.7. So, when the value actually gets to the mask, the last 0 is not there and the mask is not ready for that.
  • However, if you use a Text variable with the same value (22.70), that is the value that the mask actually receives, and so the mask works properly (assuming you configure the number of DecimalDigits to 2)
  • So, as a workaround:
    • You can create a custom column in your aggregate. In that column, use the function FormatDecimal with 2 decimal digits:
      • FormatDecimal (MyValue, 2, ",","")
    • This function returns the value as a text and so it will show up properly


Please let us know if you need any further assistance.

Samuel Jesus


I have the same issue and would really like to see this working.  Thanks for moving this forward in the backlog.

I made some progress on this.

Go to InputMasks->CurrencyMask->OnVanillaInputUpdateOrMount->MaskValue and make changes shown in bold below:

if(vanillaInput && maskedInput) {
    
    var defValue = isNaN(vanillaInput.value) ? vanillaInput.value : Number(vanillaInput.value).toFixed($parameters.DecimalDigits);
    
    $parameters.VanillaInputMaskedValue = VMasker.toMoney(vanillaInput.value, opts) !== "$ 0" ? VMasker.toMoney(defValue, opts) : "";
    $parameters.MaskedInputObj = maskedInput;
    
    if(vanillaInput.classList.contains('not-valid')) {
        $parameters.InputIsValid = false;
    }
}

Also, the cursor will jump to the end of the input box upon the first edit. For example, you would click between the 3 and the dot in 123.45 with the intent to create $12399.45, but you would get $12394.59.  This still needs a fix.

Hello guys, this will work on the NumberMask? Any solution already?

Samuel Jesus wrote:

Hello Rafael,

We were able to replicate the issue and we will add it to our backlog.

During our testing we found a possible workaround:

  • The issue is occurring because the platform considers the decimal value 22.70 as 22.7. So, when the value actually gets to the mask, the last 0 is not there and the mask is not ready for that.
  • However, if you use a Text variable with the same value (22.70), that is the value that the mask actually receives, and so the mask works properly (assuming you configure the number of DecimalDigits to 2)
  • So, as a workaround:
    • You can create a custom column in your aggregate. In that column, use the function FormatDecimal with 2 decimal digits:
      • FormatDecimal (MyValue, 2, ",","")
    • This function returns the value as a text and so it will show up properly


Please let us know if you need any further assistance.

Samuel Jesus


This didn't work, and its not a great solution if you have a lot of number inputs...

Any solution by now?

Anyone has a solution for mask numbers for mobile???


David Austin wrote:

I made some progress on this.

Go to InputMasks->CurrencyMask->OnVanillaInputUpdateOrMount->MaskValue and make changes shown in bold below:

if(vanillaInput && maskedInput) {
    
    var defValue = isNaN(vanillaInput.value) ? vanillaInput.value : Number(vanillaInput.value).toFixed($parameters.DecimalDigits);
    
    $parameters.VanillaInputMaskedValue = VMasker.toMoney(vanillaInput.value, opts) !== "$ 0" ? VMasker.toMoney(defValue, opts) : "";
    $parameters.MaskedInputObj = maskedInput;
    
    if(vanillaInput.classList.contains('not-valid')) {
        $parameters.InputIsValid = false;
    }
}

Also, the cursor will jump to the end of the input box upon the first edit. For example, you would click between the 3 and the dot in 123.45 with the intent to create $12399.45, but you would get $12394.59.  This still needs a fix.

Any news?


Vinicius Schonardie wrote:

David Austin wrote:

I made some progress on this.

Go to InputMasks->CurrencyMask->OnVanillaInputUpdateOrMount->MaskValue and make changes shown in bold below:

if(vanillaInput && maskedInput) {
    
    var defValue = isNaN(vanillaInput.value) ? vanillaInput.value : Number(vanillaInput.value).toFixed($parameters.DecimalDigits);
    
    $parameters.VanillaInputMaskedValue = VMasker.toMoney(vanillaInput.value, opts) !== "$ 0" ? VMasker.toMoney(defValue, opts) : "";
    $parameters.MaskedInputObj = maskedInput;
    
    if(vanillaInput.classList.contains('not-valid')) {
        $parameters.InputIsValid = false;
    }
}

Also, the cursor will jump to the end of the input box upon the first edit. For example, you would click between the 3 and the dot in 123.45 with the intent to create $12399.45, but you would get $12394.59.  This still needs a fix.

Any news?


Vinicius, I gave up on this edit since it was taking me too long.  This is still an open item for me.  I hope OutSystems will address this issue of currency masks soon because these Forge mobile currency mask solutions, while well intentioned, are big waste of time - exactly the opposite reason to buy OS in the first place.


Hi,

Is there any update on this its difficult to work around as it requires significant digits after the decimal.

I think if this is not fixed this component is not really useful.

Thanks

Keith


Hello guys,

First of all sorry for the late reply.

We did some tests to your suggestions with the goal of delivering a fixed version with it. However, although it worked well to present the value that comes from the Database (15.5 would be presented as $15.50) there were some new issues when typing a new value on a "clean" input.

In order to properly fix this and other issues, we are currently working on a major refactoring of the input masks mobile component.

All the feedback you have been giving will be taken into consideration for this new version, so please let us know if there are other issues or if you've been missing some features in the component.

Thank you all for your patience and feedback.


Cheers,

Samuel Jesus

Hi Samuel!

I made a copy, and added some masks: MaskBR, but as a suggestion I would include the patternMask that would allow better customization.

In the MaskBR, also have other patterns if you want more specific suggestions.

And so be discontinued! For non-duplicate components in forge!

Thx