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.

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

  • I tried to get those libraries on google. But no luck. can you help me out for giving those resource library links – Salesforce developer Jul 23 '18 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 Jul 24 '18 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.