jQuery Mask Money don't work at CFV5 field

Austre 18 Jul, 2014
Anyone use this jQuery Mask Money with CFv5?

I configured Load JavaScript
[attachment=0]cf_jquery_maskmoney_01.PNG[/attachment]

Added Field Extra Params
[attachment=1]cf_jquery_maskmoney_02.PNG[/attachment]

And when I test the form, any number key works in the respective field.
GreyHead 19 Jul, 2014
1 Likes
Hi Austre,

Is the jquery.maskMoney.js file loading in the form page? I wonder if that path is working OK.

Bob
Austre 21 Jul, 2014
Hi Grey!

The JS is loading in the form page. I can see it with the developer tools in Chrome and when I click on the field the mask appears, but no key is accepted.
[attachment=0]cf_jquery_maskmoney_03.png[/attachment]
GreyHead 23 Jul, 2014
Answer
1 Likes
Hi Austre,

With a bit of fiddling I got this working OK see here.

a) You have to set Max Length in the input to a length that includes the prefix and punctuation. On my form it is set to 12 and allows amounts up to 99,999,99 If this isn't set it blocks the entry as you found.

b) The path in the Load JavaScript action needs to be a URL (not a folder path) and should probably be an absolute URL . I used this:
http://my_domain.org/components/com_chronoforms5/extras/maskMoney/jquery.maskMoney.min.js


c) The data- attributes for the options should work OK but I switched to setting the options in the Load JavaScript box like this:
jQuery(document).ready(function (jQ) {
  jQ('#customon').maskMoney({
    decimal: ',',
    thousands: '.',
    prefix: 'R$ '
  });
});
This was because I couldn't get the space after the R$ using the data- attributes; and also because I hadn't worked out that I needed to set Max Length and was wondering why it didn't work.

Bob
Austre 23 Jul, 2014
Hi Bob!

You really are the best!!! :mrgreen:

I would have never imagined he would need to set the Max Length. Theoretically if this attribute is not set, it can take any size.

b) The path in the Load JavaScript action needs to be a URL (not a folder path) and should probably be an absolute URL . I used this:



I still had no problem with this form I used to load JS, think cause my forms are all for intranet. But i understand your recommendation.

c) The data- attributes for the options should work OK but I switched to setting the options in the Load JavaScript box like this:



Due to the same reason, I made this same change.
This topic is locked and no more replies can be posted.