jquery-maskmoney icon indicating copy to clipboard operation
jquery-maskmoney copied to clipboard

allowEmpty and allow Zero together

Open dan-developer opened this issue 10 years ago • 9 comments

You can use both options together? When the use, by clicking outside the input is empty.

dan-developer avatar Mar 20 '15 23:03 dan-developer

Could you please correct your issue? It makes no sense. I'm sure English is not your primary language but I don't have a clue to what you are asking so it's difficult to help you.

Are you asking if you can use both options together? If so, yes you can using the latest PR for allowEmpty (https://github.com/plentz/jquery-maskmoney/pull/110) but that is a question and not an issue. That is not what the issue tracker is for.

jpSimkins avatar Mar 26 '15 16:03 jpSimkins

That's what you said. But to enter "0" and click outside of the input it is set to empty and not "0.00".

Note: English is really not my main language.

dan-developer avatar Mar 26 '15 17:03 dan-developer

If allowZero is false and allowEmpty is true, then the result with "0" should be empty. If allowZero is true and allowEmpty is true, then the result should be "0".

There is a test file that checks this behavior located in the tests folder. This works as expected for me so I am not able to duplicate your issue. Try my local branch for allow empty and see if that solves your problem. Did you do any custom edits to your file?

jpSimkins avatar Mar 26 '15 22:03 jpSimkins

Entering "0" looks like this:

1

but clicking outside the input:

2

dan-developer avatar Mar 26 '15 23:03 dan-developer

Sorry it took so long to get this out. The fix is pretty simple. I updated the PR (https://github.com/plentz/jquery-maskmoney/pull/110) to have the fix. Let me know if this solves your issue.

jpSimkins avatar Apr 15 '15 23:04 jpSimkins

I have exactly same issue about this. I set both allowZero and allowEmpty to true. but on blur, it sets back to 0 when I leave as empty. Do you have this fixed? If so, which version should I use? I have hard time to find it. Thanks.

howexg9 avatar Jan 28 '16 06:01 howexg9

Any updates here?

blaketsk avatar Aug 10 '17 03:08 blaketsk

New version does not use this. This was for an older version. You will need to create a new ticket for your issue.

jpSimkins avatar Aug 12 '17 02:08 jpSimkins

The input is indeed empty on 3.1.1, but when I use $(this).maskmoney('unmasked') and the input is empty, it returns 0 instead of null.

Might have something to do with line 62:

var value = ($(this).val() || "0"),

phiter avatar Mar 14 '18 17:03 phiter