How to force number format on apex:inputText


We have an org that has advanced multi-currency activated. Since this feature is activated we are not enabled to use apex:inputField on currency fields. Instead of this we are using apex:inputText

If advanced currency management is enabled, you can’t bind Visualforce
pages that use <apex:inputField> or <apex:outputField> components to
currency fields that support advanced currency management.

The change of apex:inputField by apex:inputText to edit currency field works fine.

In addition, We also have multi-locale users.


When the field is been showing for editing the decimal symbol showed is a dot (When the locale symbol for that should be comma).

enter image description here

But, when the user try to edit this field and insert a number using comma as decimal separator a conversion error occurs.

enter image description here

Failed attempts so far

We’ve tried to replace using javascript the comma by dot onsubmit. But this symbols should depends of user’s locale.

Later, we’ve tried by using apex:input type=number but is not possible to join the field to that component.

Also, we have tried to replace the save method on the controller, and convert there the text to number, but the same error was showed.


Is there any standard solution to manage currency fields using an inputText?
Can I force the format of inputText ?

Thx for your time.


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

The doc may be contradictory as I use apex:inputField with ACM all day, every day. From the VF standard component reference:

You can’t associate this inputField with a formula merge field of type currency if your organization is using dated exchange rates.

This is saying you can’t do this:

but you can certainly do <apex:inputField value="{!opportunity.amount}"/> as my VF pages do that (actually they do : <apex:inputField value="{!ow.o.amount}"/> referring to a wrapper class around Opportunity but that shouldn’t matter.

Now outputFields are a different story and here the VF doc is consistent with your ACM doc snippet:

You cannot associate this output field with a currency merge field if that field value is calculated using dated exchange rates.

I would go with a component and its own controller that could deal with the locale issues. Pass in the currency field to the component and let the component’s controller format it for you.

Method 2

In the save method in the controller you could replace the comma with a decimal.


In the get method you could do the reverse to put the comma in for display.

Instead of:

String price{get;set;}

Define the get method and replace the decimal

public String getPrice(){
    return price.replace('.',',');

Method 3

Not sure Whether @Stephen’s answer will work for muli-local.
Check the following link also

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x