cancel
Showing results for 
Search instead for 
Did you mean: 
goh6613
Nintex Newbie

How to format number with a comma

hi all,

how can i format number with a comma to my input control (single line textbox) in nintex form ?

my input control is connected to a numeric columm.

thanks

0 Kudos
Reply
3 Replies
Chris_Ben
Nintex Newbie

Re: How to format number with a comma

Hi John,

Check out this post:  

Cheers,

Chris

Reply
goh6613
Nintex Newbie

Re: How to format number with a comma

hi Chris,

i did the suggested but its not working for me.

thanks

0 Kudos
Reply
jsexton114
Nintex Newbie

Re: How to format number with a comma

A Nintex text box (and also the TekDog Input Mask) when bound to a Numeric column both have the same behavior of removing the commas displayed by SharePoint's view. The format string setting in Nintex doesn't seem to work for me either, or I'm not sure what the intended behavior is.

However, a function to format a number with commas is available here:

"Number Format in JavaScript"

http://raovishal.blogspot.com/2012/01/number-format-in-javascript.html

Using the addCommas function and setting the JavaScript client ID variable name in Nintex to varNumericOneClientId, you could force the comma format with the following code in the form settings:

function addCommas(nStr)
{
    nStr += '';
    x = nStr.split('.');
    x1 = x[0];
    x2 = x.length > 1 ? '.' + x[1] : '';
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(x1)) {
      x1 = x1.replace(rgx, '$1' + ',' + '$2');
    }
return x1 + x2;
}

var commaFormat = addCommas(NWF$('#' + varNumericOneClientId).val());

NWF$('#' + varNumericOneClientId).val(commaFormat);

Reply