Forum Replies Created

Viewing 15 replies - 1 through 15 (of 70 total)
  • Plugin Author Petermann

    (@ivanpetermann)

    Hi @agencia221b,

    Note that the custom class is applied to the main container element of the field, not to the field itself.

    Try using a phone field on the form, and inserting this code in the footer before closing the body tag </body>:

    <script type="text/javascript">
    jQuery(document).ready(function($){
        jQuery("input.forminator-field--phone").addClass("phone");
    });
    </script>
    Plugin Author Petermann

    (@ivanpetermann)

    Hi @mirazhyk,

    Try using this code, but remember to apply the tel-new class to the phone field.

    function talisman_custom_masks_form_fields() {
        ?>
        <script type="text/javascript">
            if (typeof jQuery !== 'undefined' && typeof jQuery.fn.mff_mask === 'function') {
                function mff_mask_custom_script() {
                    jQuery('input.tel-new').mff_mask('+38(X00) 000-00-00', {
                        translation: { 'X': { pattern: /[0]/, optional: false, fallback: '0'}},
                        placeholder: "+38(0__) ___-__-__"
                    });
                }
                jQuery(document).ready(function ($) {
                    mff_mask_custom_script();
                    $(document).on('pumAfterOpen', function () {
                        mff_mask_custom_script();
                    });
                });
            }
        </script>
        <?php
    }
    
    add_action('wp_footer', 'talisman_custom_masks_form_fields', 111);
    Plugin Author Petermann

    (@ivanpetermann)

    Hi @franck-awo,

    If you are using Contact Form 7 version 5.x, you can try the code below.

    <?php
    function custom_masks_form_fields()
    {
        ?>
        <script type="text/javascript">
            jQuery(document).ready(function ($) {
                $("input[type='tel']").mff_mask('00 00 00 00 00');
            });
        </script>
        <?php
    }
    
    add_action('wp_footer', 'custom_masks_form_fields', 111);
    
    function fn_wpcf7_add_country_code_to_phone_field( $value )
    {
        if (!preg_match('/^\+33/', $value)) {
            $value = '+33 ' . $value;
        }
    
        return $value;
    }
    
    add_filter('wpcf7_posted_data_tel', 'fn_wpcf7_add_country_code_to_phone_field');
    add_filter('wpcf7_posted_data_tel*', 'fn_wpcf7_add_country_code_to_phone_field');
    Plugin Author Petermann

    (@ivanpetermann)

    Hi @marcosalexandre,

    Change the CEP field from ‘numeric’ to ‘text’ and add the code below to the /wp-content/themes/YOUR-THEME/functions.php file to see if it resolves the issue for you.

    <?php
    function my_custom_masks_form_fields() {
        ?>
        <script type="text/javascript">
            if (typeof jQuery !== 'undefined' && typeof jQuery.fn.mff_mask === 'function') {
                function mff_mask_custom_script() {
                    jQuery('input[name="cep"]').mff_mask('00000-000');
                    jQuery('input[name="ddi-geral"]').mff_mask('009');
                    jQuery('input[name="ddd"]').mff_mask('00');
                    var PhoneMaskBehavior = function(val) {
                        return val.replace(/\D/g, '').length === 9 ? '00000-0000' : '0000-00009';
                    },
                    nonoOptions = {
                        onKeyPress: function(val, e, field, options) {
                            field.mff_mask(PhoneMaskBehavior.apply({}, arguments), options);
                        }
                    };
                    jQuery('input[name="telefone"]').mff_mask(PhoneMaskBehavior, nonoOptions);
    
                }
                if ( typeof wpb_pcf_on_cf7_form_init !== "function" ) {
                    function wpb_pcf_on_cf7_form_init() {
                        mff_mask_custom_script();
                    }
                }
                jQuery(document).ready(function () {
                    mff_mask_custom_script();
                });
            }
        </script>
        <?php
    }
    
    add_action('wp_footer', 'my_custom_masks_form_fields', 111);
    Plugin Author Petermann

    (@ivanpetermann)

    Hi @mirazhyk,

    Modify the existing code as indicated below.

    <?php
    function talisman_custom_masks_form_fields() {
        ?>
        <script type="text/javascript">
            if (typeof jQuery !== 'undefined' && typeof jQuery.fn.mff_mask === 'function') {
                function mff_mask_custom_script() {
                    jQuery('input.tel-new').mff_mask('+38(X00) 000-00-00', {
                        translation: { 'X': { pattern: /[0]/, optional: false, fallback: '0'}},
                        placeholder: "+38(0__) ___-__-__"
                    });
                }
                if ( typeof wpb_pcf_on_cf7_form_init !== "function" ) {
                    function wpb_pcf_on_cf7_form_init() {
                        mff_mask_custom_script();
                    }
                }
                jQuery(document).ready(function () {
                    mff_mask_custom_script();
                });
            }
        </script>
        <?php
    }
    
    add_action('wp_footer', 'talisman_custom_masks_form_fields', 111);
    Plugin Author Petermann

    (@ivanpetermann)

    Hi @franck-awo,

    Try this.

    <?php
    function custom_masks_form_fields() {
        ?>
        <script type="text/javascript">
            jQuery(document).ready(function ($) {
                $("input[type='tel']").mff_mask('00 00 00 00 00').on('change', function () {
                    var currentValue = $(this).val();
                    if (currentValue !== undefined && currentValue !== null && currentValue != '') {
                        $(this).val('+33 ' + currentValue);
                    }
                });
            });
        </script>
        <?php
    }
    
    add_action('wp_footer', 'custom_masks_form_fields', 111);
    Plugin Author Petermann

    (@ivanpetermann)

    Hi @mirazhyk

    The test conducted directly on the website link provided initially worked correctly.

    Can you provide more details about why it didn’t work for you?

    Plugin Author Petermann

    (@ivanpetermann)

    Hi @mirazhyk

    Try using the code below.

    jQuery('input.tel-new').mff_mask('+38(X00) 000-00-00', {
        translation: { 'X': { pattern: /[0]/, optional: false, fallback: '0'}},
        placeholder: "+38(0__) ___-__-__"
    });
    Petermann

    (@ivanpetermann)

    Hi petersafetyiq21,

    Based on tests, it is affecting websites that use Oxygen Builder, ACF and theme Twenty Twenty-One activated.

    If your issue, a potential solution would be the following.

    1. Access the site via FTP
    2. Deactivate Oxygen
    3. Access WP Admin
    4. Activate the Twenty Twenty-Three or Twenty Twenty-Four theme
    5. Re-activate Oxygen

    Petermann

    (@ivanpetermann)

    Hello,

    In relation to the previous comment, the issue is related to a plugin in conjunction with WordPress 6.4, and not the theme in question. Please disregard.

    Petermann

    (@ivanpetermann)

    Hello,

    The theme has an error in the last update.

    PHP Fatal error: require(): Failed opening required 'fake/classes/class-twenty-twenty-one-svg-icons.php' (include_path='.:/usr/local/lib/php') in /var/www/htdocs/wp-content/themes/twentytwentyone/functions.php on line 529

    Plugin Author Petermann

    (@ivanpetermann)

    Hi @daprop,

    You can try using the following script to implement a custom mask.

    <script type="text/javascript">
        jQuery(document).ready(function($){
            // To apply the custom mask, add the class 'phone_custom' to the desired input field in your form
            // Apply the mask '+38(0__) ___-__-__' for the custom phone number format
            // Added 'X' for fixed '0' in the formatting using translation
            // The {placeholder: '+38(0__) ___-__-__'} defines the guide text for the mask
            jQuery('input.phone_custom').mff_mask('+38(X00) 000-00-00', {
                translation: { 'X': { pattern: /[0]/, optional: false, fallback: '0'}},
                placeholder: "+38(0__) ___-__-__"
            });
        });
    </script>

    Click here for more details on how to add custom mask.

    Should you need any further information, please do not hesitate to contact me. Thank you very much for your contact.

    Plugin Author Petermann

    (@ivanpetermann)

    Hi @it-hertz,

    It’s unfortunate that the outcome didn’t fully meet your expectations. Unfortunately, the specific feature you’re looking for is not available in the jQuery Mask Plugin library that I’m using for the plugin. After analyzing the other plugin you mentioned, I noticed that it utilizes a different library. However, it’s important to note that this library was discontinued in December 2017.

    Thank you very much for your feedback and for using my plugin. If there’s anything else I can help with, please don’t hesitate to let me know.

    Plugin Author Petermann

    (@ivanpetermann)

    Hi @it-hertz,

    You can try using the following script to implement a custom mask in the US phone number format with the use of a placeholder.

    <script type="text/javascript">
        jQuery(document).ready(function($){
            // To apply the custom mask, add the class 'phone_us_custom' to the desired input field in your form
            // Apply the mask '(000) 000-0000' for the US phone number format
            // The {placeholder: '(___) ___-____'} defines the guide text for the mask
            // The {clearIfNotMatch: true} allows clearing the field if the input doesn't match the mask
            jQuery('input.phone_us_custom').mff_mask('(000) 000-0000', {placeholder: '(___) ___-____', clearIfNotMatch: true});
        });
    </script>

    Click here for more details on how to add custom mask.

    Should you need any further information, please do not hesitate to contact me. Thanks for your suggestions!

    Plugin Author Petermann

    (@ivanpetermann)

    Dear @patrickhess,

    I would like to know if the issue you were facing has been resolved.

    I appreciate your feedback.

Viewing 15 replies - 1 through 15 (of 70 total)