sansanbgl / jquery-formatcurrency

Automatically exported from code.google.com/p/jquery-formatcurrency
GNU General Public License v3.0
0 stars 0 forks source link

Number reset to 0 when symbol set to '' #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Set input element value to 1,234.56.
2. Call $(element).formatCurrency({ symbol: ''}); on input element.
3. Verify input element value is 0.

What is the expected output? What do you see instead?
See above.

What version of the product are you using? On what operating system?
jquery.formatCurrency-1.2.0.js, IE8 & Chrome

Please provide any additional information below.

Bugfix:
1. Removed 'symbol|' part from regex, we want to strip all symbols
2. Replaced '.' wildcard character with '\\.'

function generateRegex(settings) {
    var decimalSymbol = settings.decimalSymbol.replace('.', '\\.');
    return new RegExp("[^\\d" + decimalSymbol + "-]", "g");
}

Original issue reported on code.google.com by msg.ja...@gmail.com on 4 Dec 2009 at 12:38

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Accepted, Thanks for pointing this out.  This has been fixed in the trunk and 
will 
be included in v1.3.  

As for the decimalSymbol issue, it is contained within a [] character literal 
and 
doesn't require the escaping.  If you find this to be an error still, please 
create 
a new issue with the browser that is experiencing the issue.

Original comment by bdewe...@hotmail.com on 4 Dec 2009 at 3:25

GoogleCodeExporter commented 8 years ago
Released with v1.3

Original comment by bdewe...@hotmail.com on 2 Jan 2010 at 4:35