Displaying Numbers in an Input Field with Two Decimal Places

Hey Everyone…

I have an input field for a money based number that I want to display as always having two decimal places, even when their values are “.00” So for example, I want the input to view as “30.00” and not just “30”.

I can’t set the Content Format as Currency as I don’t want a fixed currency prefix and there isn’t an option to have no prefix.

Is there a solution to this?

Best wishes,
Antony.

The only thing I can think of is to set the input’s Content Format as “Currency” and then set a condition to change the the currency’s prefix depending on the user’s locale (you could use a plugin to achieve the latter). Although you stated that you don’t want to set the Content Format to “Currency”, this may solve the issue of having a fixed currency prefix. Similarly, you could also add a button for the user to select a preferred prefix and set a state on the input so that whenever that button is clicked, a workflow will set the state of the input to “x”, allowing you to create a condition to change the prefix based on “x”.

Hello @antony,

Maybe with the input formatter plugin you can do this?

Let me know if this helps.

Bests.

Hey @ryanck, thanks for that idea… there are soooo many plugins now that I can’t keep track of what is available. I’ll check that one out! :slight_smile:

Hope it works.

jeje, yeah I feel you.

Have a nice day.

Hi again @ryanck… I just took a look on the forums about it, and there are various issues that have been raised about how it works, especially in reusable elements. That seems a common theme with GUI type plugins… and my whole app is based around reusable elements, so I’m guessing it may throw up some problems for me… :frowning:

I’ve been toying with this, as was interested in what can be done.

I’m not sure if this is much use, but you could do the following:

  1. Add an input to the page, set the content format to currency.
  2. Check always show decimals
  3. Then on the currency prefix, click in the dropdown and press backspace to remove and hit enter. This should remove the currency prefix and leave blank. It will flag red as an error to say its missing, but it doesnt cause an app errors, so I assume all good to use. Gif below:
    currency-set

Result:
Peek%202019-04-12%2013-29

2 Likes

Oh sorry man :open_mouth:

Hope you can get this working somehow. If something comes up to my mind I´ll let you know.

This topic was automatically closed after 70 days. New replies are no longer allowed.