Address Zip/postal code Mask


I can’t seem to find any information on this, so I thought maybe someone can help me here.

I am looking to add a mask to the postal code field.

I have tried this code but it doesn’t work or needs further modification.

add_filter( 'gform_input_masks' , 'add_mask' );

function add_mask( $masks ) {

$masks [ 'Postal Code' ] = 'A9A 9A9' ;

return $masks ;


Thanks for any help.

The input mask does not apply to the ZIP or Postal Code field of the Advanced Address field. If you want to enforce that format for the postal code, you can use a single line text field to capture the postal code, and use your new input mask there. When adding this custom mask with the gform_input_masks filter, the new mask should be a choice in the input mask drop down. Screenshot after I added your code to my site:

thanks for your reply but this is not what I was looking for. I am aware that you can create custom masks for single line text box.

I need it for the address field and utilize the map link given as well. It would be nice to have a correctly formatted postal code.

I have learned that currently this cannot be done for some reason which does not make sense to me.

If you would like to suggest this enhancement to our product team, you can leave a note on our product roadmap.

Click the blue plus sign in the lower left to get started. Thank you.