Support

Account

Home Forums General Issues Price Field and JS Mask

Solved

Price Field and JS Mask

  • Hi @elliot. okay with you? I hope so..
    I’m with a small deadlock here in my development, the client needs to register the field “Price” but requires a mask in which the values were assembled as 250.000,00 (two hundred and fifty thousand) and registered in the database as 250000. Or a value less, ex: 20.00. Is this possible with your plugin?

  • Hi @websul

    This mask can be achieved using a jQuery plugin. Please search jQuery mask on google to find the code.

    Then, just write some custom jQuery code to add this mask onto the desired input.
    The input will have a specific ID which you can find by looking at it via firebug/inspector/page source.

    Please also take a look at the documentation article covering how to add JS to ACF input pages.

    Thanks
    E

  • This reply has been marked as private.
  • Hello, enjoying the topic.

    I have implemented masks in acf fields in the backend, using if (isset ($ current_screen-> post_type) && in_array ($ current_screen-> post_type, array (‘example’) so I choose which cpt to include the masks in.

    I would like to include the masks in the user registration form, I already have a group of custom fields that are being displayed, I use the latest version acf pro, could someone help me?

    Tks.

  • hi,

    You can create field price as number field, and show format price width php

    price filed value: 20000000

    php format

    
    <?php $price = get_field('price'); ?>
    <?php echo number_format($price, 0); ?>

    You have html format: 20,000,000

    All format you can check here: http://php.net/manual/en/function.number-format.php

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Price Field and JS Mask’ is closed to new replies.