Format Currency

rss

Posted by schuess - Feb 13 ’14 at 12:32

I am trying with no success to format a currency field on the new form. I would like it to either add the $ and commas during typing if possible. I have tried to use a popular jquery library called .formatCurrency(), but with no luck.

LInk to library: https://code.google.com/p/jquery-formatcurrency/

 

Error Message:

SCRIPT438: Object doesn't support property or method 'formatCurrency'"

 

Code Attempts:

//Format Currency Fields

$('.fd_field[fd_name="bidSecurityAmount"]').formatCurrency(); //using the library

 

//seperate attempt without the library

$('.fd_field[fd_name="bidSecurityAmount"]').text('$' + parseFloat(total, 10).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").toString());

 

I referrenced the script library using a custom action with visual studio to deploy a script link

 

If you can help me in any way to try and apply currency formating to a field as the user types, that would be great. At the lease format the currency after they click off the field.

 

Thanks

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 8 years 10 months 17 days
    #1 by Dmitry Kozlov Feb 16 ’14 at 07:56

    Forms Designer includes JQuery library in compatibility mode, so, variables jQuery and $ are not defined globally. If you include additional plugins based on jQuery library and wish to use them on customized with Forms Designer forms only, you have to pass them $fd_jQuery variable instead of jQuery. So, please, open jquery.formatCurrency-1.4.0.js file and replace jQuery with $fd_jQuery.

    If you use your own jQuery library with formatCurrency plugin then call window.$.formatCurrency() function in JS-editor of Forms Designer.

  • schuess
    schuess
    Member
    Member for: 8 years 6 months 16 days
    #2 by schuess Feb 18 ’14 at 03:30

    The jQuery Plugin i want to use seems to want to format the input text box, but when i try and supply my field, i seem to be supplying the entire div/field.

     

    $('.fd_field[fd_name="bidSecurityAmount"]').change(function(){
    //fd.field('bidSecurityAmount').control()._el().value().formatCurrency();
    //$('.fd_field[fd_name="bidSecurityAmount"]').formatCurrency();
    //$('.fd_field[fd_name="bidSecurityAmount"]'.val()).formatCurrency();

    });

    the swtiching back and forth between js-framework and the plugin framework seems to be causing me trouble.

    how can i send the value of my input to a 3rd party plugin?

     

    thanks D.

     

    Matt

     

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 8 years 10 months 17 days
    #3 by Dmitry Kozlov Feb 19 ’14 at 04:12

    [#2]: Hi Matt,

    It seems, you should pass control to this plugin instead of just value. Try the following code:

    $('.fd_field[fd_name="bidSecurityAmount"] input').formatCurrency()
    
  • schuess
    schuess
    Member
    Member for: 8 years 6 months 16 days
    #4 by schuess Feb 19 ’14 at 09:28

    That worked perfectly.

     

    Would i have known that with a greater understanding of javascript or html or from a better understanding of js-framework?

     

     

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 8 years 10 months 17 days
    #5 by Dmitry Kozlov Feb 20 ’14 at 04:36

    [#4]: Of course, our framework is based on jQuery. So, I recommend you to start with javascript and jQuery smile

  • Bowni
    Member
    Member for: 5 months 20 days
    #6 by Bowni Mar 5 ’22 at 03:50

    Now the currency is undergoing a big change and most people consider digital money to be the currency of the future. Perhaps these people are right, because bitcoin is really wildly popular. If you want to make money with cryptocurrencies, then you should learn more about crypto bot and the possibilities of this useful tool.

  • Patrick Chapman
    Member
    Member for: 3 months 13 days
    #7 by Patrick Chapman Apr 27 ’22 at 07:14

    This formula can really help the development of cryptocurrency and e-commerce. In general, looking at recent trends, I think that businesses must introduce cryptocurrency payment because there is a huge demand from users. Especially after the bull run that we had, a lot of people would have the opportunity to pay in cryptocurrency.

  • emmawatson98
    Member
    Member for: 3 months 9 days
    #8 by emmawatson98 May 1 ’22 at 03:51

    Get 15% OFF charles bentley discount code with our free Discount Codes, Voucher Codes and Promo Codes. Updated on a daily basis so that you save maximum on your order at charles bentley !!

  • AugustBlack
    Member
    Member for: 1 day
    #9 by AugustBlack Aug 7 ’22 at 08:05

    I am an experienced trader, but even I periodically need new information and some advice for traders. Usually, everything I need, I can easily find on the Internet in sources such as https://world-today-news.com/choose-the-best-forex-broker-important-factors-to-consider-2/. If you are new to trading, then I consider the study of this information to be a necessary step on the way to an excellent result.

  • AugustBlack
    Member
    Member for: 1 day
    #10 by AugustBlack Aug 7 ’22 at 08:06

    I am an experienced trader, but even I periodically need new information and some advice for traders. Usually, everything I need, I can easily find on the Internet in sources such as https://world-today-news.com/choose-the-best-forex-broker-important-factors-to-consider-2/. If you are new to trading, then I consider the study of this information to be a necessary step on the way to an excellent result.

Displaying 1 to 10 of 11 messages
Previous12