Background
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.
Problem
When the field is been showing for editing the decimal symbol showed is a dot (When the locale symbol for that should be comma).
But, when the user try to edit this field and insert a number using comma as decimal separator a conversion error occurs.
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.
Query
Is there any standard solution to manage currency fields using an inputText
?
Can I force the format of inputText
?
Thx for your time.
Best Answer
The doc may be contradictory as I use
apex:inputField
with ACM all day, every day. From the VF standard component reference:This is saying you can't do this:
value="{!IF(foo__c,opportunity.amount,opportunity.next_best_amount__c)}"
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:
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.