How to mask input field?


#1

Hi everyone, I have a text field that the user is able to enter money amounts.

When they enter for instance: 50, after pressing enter or tab, I want the input to have a mask and show $50.00
How do I add the $ before the number and how do I mask the number so that it contains always “.00” point and two decimals afterwards in case the user didn’t entered it.

Also, this input will then sum up with other inputs in a totals text field, so is the mask or the dollar sign going to interfiere with the sum?

N.


#2

Hi!

This post shows how to do this. (It also inserts commas for thousands, millions, etc.) Basically, copy and paste the second expression in this post into the Set Text command upon OnLostFocus for the field.

Here’s an example using that expression: format-dollar.rp (47.1 KB)


#3

You are a lifesaver!!! Thanks!