CalcBuilder Forum

Mask for money does not calculate

User dhoeke 2026-03-31 09:35:33

Good morning,

For a calculator calculating mortgage interest, I would like to mask the intitial mortgage (amount of money). Top field.

For the interest rate I use a mask as well being #,##%

Now when I use the mask for the amount like 000.000 with a prefix €, the entering of the amount goes fine, but the results are zero.
I also have this in the JS before calc:

CB('').unmask();
CB('').unmask();

Not sure it that does something..

The inline results work fine with own format and adding the € sign. But I would like them to be consistent with the input. Now the input is just like 300000 instead of €300.000

I would like the user to be able to input any amount from like 50.000 up to 5.000.000.

Thanks in advance.

User dhoeke 2026-04-01 10:07:33

Update on this.
When I use a mask of #. Any value can be used. That is good. Also the calculator works.
Now if I use €#, the calculator does not work.
Weird because on another field I use #,##% and that works fine when calculating..

Moonsoft support 2026-04-01 10:10:15

Hi,
the code to unmask user input before sending It to the calculator is ok, and it's required so the calculator can work with numbers.But that event 'before calculate' is launched when the button is pressed, for your case you also need to unmask when online calculations are launched, because inline outputs are generated on each field change. It's quite complex to capture that event with plain js, so please wait to next version that Will be released next Tuesday, we'll include a new js tab 'before inline' where you Will be able to place the unmask function and thus continue your calculations with the proper values.
Kind regards
Guillermo V.
Moonsoft Team

User dhoeke 2026-04-01 12:03:59

Ah, that makes sense. Thanks for the information.

User dhoeke 2026-04-01 12:08:23

As feedback after reading the above. If I hit the calc button with using mask €# also the result is 0 while having the unmask codes in place.

...
Support/development 40 hours

With the peace of mind of having a professional team at your service (20% discount)

Buy now!
...
CalcBuilder

Create dynamic calculators

Buy now!