Format Currency
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
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
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
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.
If you use your own jQuery library with formatCurrency plugin then call window.$.formatCurrency() function in JS-editor of Forms Designer.
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
$('.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
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi Matt,
It seems, you should pass control to this plugin instead of just value. Try the following code:
It seems, you should pass control to this plugin instead of just value. Try the following code:
Code: Select all
$('.fd_field[fd_name="bidSecurityAmount"] input').formatCurrency()
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Of course, our framework is based on jQuery. So, I recommend you to start with javascript and jQuery
-
- Information
-
Who is online
Users browsing this forum: No registered users and 5 guests