frm_input_masks

Back to Top
Knowledge Base → frm_input_masks

Parameters

  • None

Examples

Formidable Hook - Helpful

Add a mask to Credit Card

Submitted by srwells — 7 years ago

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;
}
If you would like to add your own example, click here.

Have something to add?

Click here to provide feedback on this page.