Skip to content

Commit dbd934c

Browse files
authored
gpaa-autocomplete-zip.js: Migrated from GitHub Gists. (#575)
`gpaa-autocomplete-zip.php`: Migrated from GitHub Gists.
1 parent 480f3cf commit dbd934c

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Gravity Perks // GP Address Autocomplete // Show ZIP as Results
3+
* https://gravitywiz.com/documentation/gravity-forms-address-autocomplete
4+
*
5+
* Instructions:
6+
* 1. Install our free Custom JavaScript for Gravity Forms plugin.
7+
* Download the plugin here: https://gravitywiz.com/gravity-forms-custom-javascript/
8+
* 2. Copy and paste the snippet into the editor of the Custom Javascript for Gravity Forms plugin.
9+
* 3. Install accompanying gpaa-autocomplete-zip.php snippet
10+
* 4. Change addressFieldId to the Address Field's ID
11+
*/
12+
window.gform.addFilter( 'gpaa_autocomplete_options', function( options ) {
13+
options.types = ['postal_code'];
14+
15+
return options;
16+
} );
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* Gravity Perks // GP Address Autocomplete // Show ZIP as Results
4+
* https://gravitywiz.com/documentation/gravity-forms-address-autocomplete
5+
*
6+
* Instructions:
7+
* 1. Install snippet per https://gravitywiz.com/documentation/how-do-i-install-a-snippet/
8+
* 2. Update FORMID to the Form ID and FIELDID to the Address Field ID.
9+
* 3. Hide the Address Line 1, Address Line 2, City, and State inputs from the Form Editor if desired.
10+
* 4. Install accompanying gpaa-autocomplete-zip.js snippet
11+
*/
12+
add_filter( 'gpaa_init_args_FORMID_FIELDID', function( $args ) {
13+
$args['inputSelectors']['autocomplete'] = '#input_FORMID_FIELDID_5';
14+
15+
return $args;
16+
});

0 commit comments

Comments
 (0)