Skip to content

Instantly share code, notes, and snippets.

@richardW8k
Last active December 28, 2015 16:29
Show Gist options
  • Save richardW8k/7529589 to your computer and use it in GitHub Desktop.
Save richardW8k/7529589 to your computer and use it in GitHub Desktop.
Activate input mask for list field columns. If no other field types have input masks enabled you will also need to enqueue the masked input script, see the following gist for an example https://gist.github.com/richardW8k/7529522
<script>
function ListFieldMaskedInput( formId, fieldId, column, mask ){
jQuery( '.gfield_list_' + fieldId + '_cell' + column + ' input' ).mask( mask );
jQuery( '#field_' + formId + '_' + fieldId ).on( 'click', '.add_list_item', function(){
jQuery( '.gfield_list_' + fieldId + '_cell' + column + ' input' ).mask( mask )
});
}
ListFieldMaskedInput( 11, 2, 1, '9999' );
/**
* Add a function call for each list field column you want to activate an input mask for
* ListFieldMaskedInput( formId, fieldId, column, 'mask' );
* for examples of input masks see http://www.gravityhelp.com/documentation/page/Input_Mask
*/
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment