Description
Use this filter to change the initialization script for the input mask script. Can be used to specify different initialization parameters.
Usage
<?php
add_filter("gform_input_mask_script", "set_mask_script", 10, 4);
?>
You can also target a specific form by adding the form id after the hook name.
<?php
add_filter("gform_input_mask_script_6", "set_mask_script", 10, 4);
?>
Parameters
$script
- (string) The script (including <script> tag) to be filtered.
$form_id
- (int) ID of current form.
$field_id
- (int) ID of current field.
$mask
- (string) Currently configured mask.
Examples
This example changes the placeholder character to a blank space (" ")
<?php
add_filter("gform_input_mask_script_185", "set_mask_script", 10, 4);
function set_mask_script($script, $form_id, $field_id, $mask){
$script = "<script type='text/javascript'>//<![CDATA[\njQuery(document).ready(function(){" .
"jQuery('#{$field_id}').mask('{$mask}',{placeholder:' '});" .
"});\n//]]></script>";
return $script;
}
?>
A full list of available initialization options 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 common.php