Created
March 8, 2022 01:43
-
-
Save claygriffiths/c5573f078858c6271a393fb8ad787ca8 to your computer and use it in GitHub Desktop.
GP Address Autocomplete: Show Cities as Results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Gravity Perks // GP Address Autocomplete // Show Cities as Results | |
* https://gravitywiz.com/documentation/gravity-forms-address-autocomplete | |
* | |
* Instructions: | |
* 1. Install our free Custom JavaScript for Gravity Forms plugin. | |
* Download the plugin here: https://gravitywiz.com/gravity-forms-custom-javascript/ | |
* 2. Copy and paste the snippet into the editor of the Custom Javascript for Gravity Forms plugin. | |
* 3. Install accompanying gpaa-autocomplete-cities.php snippet | |
*/ | |
window.gform.addFilter( 'gpaa_autocomplete_options', function( options ) { | |
options.types = ['(cities)']; | |
return options; | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Gravity Perks // GP Address Autocomplete // Show Cities as Results | |
* https://gravitywiz.com/documentation/gravity-forms-address-autocomplete | |
* | |
* Instructions: | |
* 1. Install snippet per https://gravitywiz.com/documentation/how-do-i-install-a-snippet/ | |
* 2. Update FORMID and FIELDID accordingly | |
* 3. Hide the Address Line 1 and Address Line 2 inputs from the Form Editor if desired. | |
* 4. Install accompanying gpaa-autocomplete-cities.js snippet | |
*/ | |
add_filter( 'gpaa_init_args_FORMID_FIELDID', function( $args ) { | |
$args['inputSelectors']['autocomplete'] = '#input_FORMID_FIELDID_3'; | |
return $args; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment