Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This hook allows you to add an input mask.
Usage
add_filter( 'frm_input_masks', 'add_cc_mask', 10, 2 );
Parameters
- $masks (array)
Examples
Add a mask to Credit Card
This will add an input mask the the credit card number. Please note, this is a set format and will not work with all credit card types i.e. American Express.
add_filter( 'frm_input_masks', 'add_cc_mask', 10, 2 );
function add_cc_mask( $masks, $forms_on_page ) {
foreach ( $forms_on_page as $form ) {
if ( $form->id == 10 ) { // replace 10 with your form id
$masks['FIELDKEYHERE_cc'] = '9999-9999-9999-9999'; // replace FIELDKEYHERE with your field key
}
}
return $masks;
}