joejuzl / jquery-formatcurrency

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

Blank = 0.00 Incorrectly #11

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Set blur on a text input
2. leave that field blank, click in it, click off it (not changing value of
blank)
3. Sets value to 0.00 incorrectly

What is the expected output? What do you see instead?
Blank, saw 0.00

What version of the product are you using? On what operating system?
1.1

Please provide any additional information below.

Original issue reported on code.google.com by samih...@gmail.com on 10 Nov 2009 at 3:50

GoogleCodeExporter commented 8 years ago
Any update?

Original comment by samih...@gmail.com on 16 Nov 2009 at 11:02

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I didn't want formatCurrency to mess with any non-numerical (or blank) values, 
so
after line 63:
num = $this[$this.is('input, select, textarea') ? 'val' : 'html']();

I added the following code:

// If the value isn't numeric, don't mess with it
if(!num.match(/^[0-9.,$]+$/)) { return; }

Original comment by gwel...@gmail.com on 18 Nov 2009 at 5:13

GoogleCodeExporter commented 8 years ago
This seems like wanted behaviour to me.

Original comment by eric.marden on 23 Nov 2009 at 6:32

GoogleCodeExporter commented 8 years ago
Fixed in the trunk

Original comment by bdewe...@hotmail.com on 28 Nov 2009 at 2:58

GoogleCodeExporter commented 8 years ago

Original comment by bdewe...@hotmail.com on 28 Nov 2009 at 3:12

GoogleCodeExporter commented 8 years ago
To  eric.marden's point I feel that if you want a zero value you should just 
set it 
to zero before formatting.  thoughts on adding this as a option?

Original comment by bdewe...@hotmail.com on 28 Nov 2009 at 3:31

GoogleCodeExporter commented 8 years ago
Option is fine, but setting to 0.00 shouldn't be the default. Thanks for fixing 
this!

Original comment by samih...@gmail.com on 28 Nov 2009 at 6:23