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

Difficulty in changing values in an easy way

Open paaljoachim opened this issue 9 years ago • 5 comments

Hey

The WordPress plugin Give https://github.com/WordImpress/Give/issues/110#issuecomment-95345412 uses maskmoney for their custom donation field.

One thing that is difficult is clicking into the text field and changing a value.

Right now: Cursor blinks behind the 0.00 amount. Delete keyboard key does not work. Writing for instance 50 the amount changes to 0.50. Writing again 00 it then moves the amount forward to become 50.00. Just a minor hassle but just removing the 0.00 giving an open space for the user to write the amount would be better.

Could this be adjusted making the process easier?

paaljoachim avatar Apr 22 '15 22:04 paaljoachim

Here's a link of that in action: http://givewp.com/demo

DevinWalker avatar Apr 22 '15 22:04 DevinWalker

Hi guys.

The value 0.00 value is displayed with the cursor on the right side to make the user know that every typed number will be placed right there and 'moved' to the other point. This makes it simple to type values without bothering with decimal separators. It's currently a feature for applications where the user makes heavy use of the keyboard(tab... 123... tab... 456, and so on). Not showing the 0.00 value can force the user to type the decimal separator or just surprise it by applying the separator at some moment.

I think your request would be more acceptable like an option, like:

$("#field").maskMoney({userNeedsToWriteExactlyTheAmount: true}};

Can you guys open a PR with your suggestion?

gregoriokusowski avatar May 06 '15 22:05 gregoriokusowski

What about if the separator were automagically added? That would be the best option

DevinWalker avatar May 06 '15 22:05 DevinWalker

@DevinWalker @paaljoachim well, I think that what you want is just this:

var field = $('#field');
field.on("blur", function(){
    field.maskMoney('mask');
}

plentz avatar May 07 '15 01:05 plentz

@plentz I just gave that a shot and couldn't get it working as expected. Nothing appear to happen on blur to the input.

$body.on( 'blur', '.give-donation-amount .give-text-input', function ( e ) {
//CODE HERE
//Fire up Mask Money
        $( this ).maskMoney( 'mask', {
            decimal  : give_global_vars.decimal_separator,
            thousands: give_global_vars.thousands_separator
        } );

});

DevinWalker avatar May 10 '15 02:05 DevinWalker