Inputmask icon indicating copy to clipboard operation
Inputmask copied to clipboard

Currency - Visually display the difference between $0.00 and NULL

Open MS37 opened this issue 11 years ago • 9 comments

Would like to support currency values of $0, NULL (no value) and valid amounts and have it displayed so the user can tell the difference between a value of $0.00 and NULL (no value).

Ideally, when a null is stored the control should be blank when the focus leaves the control (its OK if the mask shows $0.00 on focus/hover).

When a $0 is stored the control should show $0.00 (even when not hovered or focused) - as it does with a valid amount ($1.00).

http://jsfiddle.net/a4uhkh5p/1/

MS37 avatar Dec 19 '14 22:12 MS37

@MS37 ,

I totally agree, but the current implementation of the numeric alias does not allow it. Once I can remove the postFormat fn from the numeric alias, I will implement it.

RobinHerbots avatar Feb 09 '15 00:02 RobinHerbots

Sounds good. Thanks!

MS37 avatar Feb 09 '15 13:02 MS37

Hi, I don't know if it is bad posting this here, but i have the same question and tough opening a new issue would be a bit double. I saw there was great progress on milestone 3.2 any thoughts on when this will be possible or maby a temporarily workaround?

Thanks, Ricardo

sillentkil avatar Apr 01 '15 09:04 sillentkil

Hi

Sorry to spam this issue but as with silent kill am after a workaround. I've tried extending the onUnmask call locally to my use of the currency alias and this works some of the time but unfortunately falls over as soon as you use back space to clear the value in the input.

any ideas would be gratefully received.

cheers

electroholic avatar Jun 30 '15 18:06 electroholic

Sorry i also tried extending and ran into more problems, unfortunately i didnt had any time to look in to it any further.

I have my mask setup like this although not 100% what i want: mask: '9{0,*}[.99{0,5}]', greedy: false, autoGroup: true, digitsOptional: false,

sillentkil avatar Jul 10 '15 11:07 sillentkil

@MS37 , @sillentkil , @electroholic ,

Can you have a try with the current implementation. Visually it is the same, but the behavior is different and also a 0 input is submitted on postback.

RobinHerbots avatar Jul 27 '15 13:07 RobinHerbots

What about the non-visual part? The backend needs to know whether the user entered 0.00 or NULL (no-value). Tested it in current dev and it's still always getting "0.00" instead of "".

EDIT: Should I submit a new issue?

vercotux avatar Aug 03 '15 02:08 vercotux

Tested the update. Works beautifully.

vercotux avatar Aug 03 '15 08:08 vercotux

Tested the update in d558785.

After entering 0.00, I was not able to enter NULL (no value) anymore.

My settings:

    $('#field').inputmask('decimal', {
        integerDigits: 7,
        digits: 2,
        radixPoint: ',',
        rightAlign: false,
        digitsOptional: false,
        placeholder: '0',
        allowMinus: false,
        allowPlus: false
    });  

Thansks, Mauricio

mauricio-bordon avatar Aug 07 '15 14:08 mauricio-bordon