bookmark_bordergform_input_masks

Description

Use this filter to edit the list of built-in input masks that are displayed in the Text Field input mask setting. Useful when adding a new custom input mask that will be used repeatedly.

Usage

add_filter( 'gform_input_masks', 'add_mask' );

Parameters

  • $masks array

    Current list of masks to be filtered, in the following format:

        array(
            'US Phone' => '(999) 999-9999',
            'US Phone + Ext' => '(999) 999-9999? x99999',
            'Date' => '99/99/9999',
            'Tax ID' => '99-9999999',
            'SSN' => '999-99-9999',
            'Zip Code' => '99999',
            'Full Zip Code' => '99999?-9999'
        );
        

Examples

This example adds a new predefined mask for “Product Key”.

add_filter( 'gform_input_masks', 'add_mask' );
function add_mask( $masks ) {
    $masks['Product Key'] = 'a*-999-a999';
    return $masks;
}

Documentation on how to create custom masks can be found at:

http://digitalbush.com/projects/masked-input-plugin/

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

This filter is located in GFFormsModel::get_input_masks() in forms_model.php