13,355,093 members (59,129 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I want to eformat the text box by using the comma(,) operator.
I need to create a project that is having a text box control that is to get the indian rupees as input.while the user is entering the input it should automatically format the input by adding the comma operator,that is ie. 1,00,000 for this input is 100000.the comma should be inserted automatically while the user entering the value in the text box.

will you please help me to get the answer ..........
Posted 18-Nov-12 18:16pm

## 3 solutions

Rate this:
Please Sign up or sign in to vote.

## Solution 2

Go to this link
http://www.integraxor.com/blog/number-formatter-is-now-localized
download numberformat.js . its simple plug in. supports multiple format of currency, very easy to use. We have been uses it our online retail project.

How to use it..
add .js to your website,

on blur of text field.
```\$('input[id\$="totalAmount"]').val(format("###,###,###.##",amount.toFixed(2)));
```

on calculation of amount replace , and other separator.
`var temp=(\$('input[id\$="totalAmount"]').val()).replace(/\,/g,"");`
Rate this:
Please Sign up or sign in to vote.

## Solution 1

use javascript

```<script type="text/javascript" language ="javascript">
function Comma(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;
}
</script>```
Rate this:
Please Sign up or sign in to vote.

## Solution 4

I need to create a project that is having a text box control that is to get the indian rupees as input.while the user is entering the input it should automatically format the input by adding the comma operator,that is ie. 1,00,000 for this input is 100000.the comma should be inserted automatically while the user entering the value in the text box.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Top Experts
Last 24hrsThis month
 OriginalGriff 161 Jochen Arndt 155 F-ES Sitecore 145 ppolymorphe 70 CPallini 40
 OriginalGriff 4,312 Jochen Arndt 1,356 ProgramFOX 1,268 Maciej Los 1,210 Karthik Bangalore 1,151

Advertise | Privacy |
Web04 | 2.8.180111.1 | Last Updated 18 Apr 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100