1

I am using apex:inputText that holds a string with number(Integer) at controller side. Is there any way to display it as Number with commas (in USD Currency format)after typing input.

1 Answer 1

0

Hi Salesforce Developer,

If it has to be an apex:inputText using jQuery and jMaskedInput should solve your problem. All Input in the apex:inputText should then be masked as the format you choose.

<apex:page >    
    <apex:includeScript value="{!$Resource.JQuery}"/>   
    <apex:includeScript value="{!$Resource.JMaskedInput}"/> 
    <script>    
        $(document).ready(function() {
            $(".curr-mask").mask("999 999 999.99"); 
        }); 
    </script>   
    <apex:form id="testform" > 
        <apex:inputText id="txtCurr" styleClass="curr-mask"/> 
    </apex:form>
</apex:page>

InputText

Some older Post in the developerforce forums: https://developer.salesforce.com/forums/?id=906F000000095o2IAA

2
  • I tried to get those libraries on google. But no luck. can you help me out for giving those resource library links Commented Jul 23, 2018 at 12:19
  • jQuery you can get from the jQuery main page: jquery.com/download jMaskedInput can be aquired from their github: github.com/digitalBush/jquery.maskedinput you need to upload the two .js files to your salesforce instance as static ressource. After that you can use them as described above with $Ressource. prefix.
    – mseehase
    Commented Jul 24, 2018 at 13:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .