Skip to content

Commit 5172120

Browse files
authored
gpaa-trim-us-zip-codes.js: Created new snippet to trim US zip codes to the first 5 digits (e.g. 12345-6789 → 12345).
1 parent 40d4fcf commit 5172120

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Gravity Perks // Address Autocomplete // Trim US Zip Codes to First 5 Digits
3+
* https://gravitywiz.com/documentation/gravity-forms-address-autocomplete/
4+
*
5+
* Instructions:
6+
*
7+
* 1. Install this snippet with our free Custom JavaScript plugin.
8+
* https://gravitywiz.com/gravity-forms-custom-javascript/
9+
*/
10+
gform.addFilter( 'gpaa_values', function( values, place ) {
11+
values.postcode = values.postcode.split( '-' )[0];
12+
return values;
13+
} );

0 commit comments

Comments
 (0)