Append value typed in text field with a percent sign

There must be an obvious way to do this that I am just missing. I have a table with fields all of which look like the field in this example:

The values that people type into the fields are supposed to be percentages (hence the hint text ‘%’). I would like to make it so that:

  • If the user types in a value but no % sign…the field automatically appends a % at the end of the value.
  • If the user types in a value with a % sign…the field does not add a second % at the end.

Thanks in advance for all help and suggestions!
sample_percent_field.rp (45.9 KB)

Hi afinpdx,

The simplest solution is often the best. I’ve hit this sort of problem many times before. I modified your sample as you can see below.

When there is a symbol such as currency or a percentage, it is really metadata, so it’s best to move it out of the input field entirely. In this way, you don’t have to worry about the user adding or removing the percent at all. I right-aligned the text input and placed the percent symbol right beside it so that it lines up nicely.

sample_percent_field_simplified.rp (46.8 KB)

I hope this helps you get the effect you want.



Thanks Bill-
I agree that sometimes the simplest is the best…and you’re right that by just moving the % sign out of the field I kinda accomplish the same thing. I’ll probably wind up doing just that.

I can’t deny though that I was hoping to learn a new trick that would handle it through a variable or function. But I’m probably asking for more trouble than is necessary.

Thank you for that sound recommendation!

You are most welcome! Anything is possible with some fancy string handling, but it’s messy in axure and doesn’t scale since it’s not really a coding environment. When dealing with many values, or when you might have temperature or angles in degrees, various currencies, percentages, kW, Amps etc. I put the units outside the field.

Credit card entry is the only input type where it might be worth complex string mangling since there are various groupings and string lengths possible depending on the card type.


And truth be told…keeping the % sign visible all the time is probably a better experience anyways. Thanks.