Show ZIP as Results

Instructions

  1. Install snippet per https://gravitywiz.com/documentation/how-do-i-install-a-snippet/
    1. Update FORMID to the Form ID and FIELDID to the Address Field ID.
    2. Hide the Address Line 1, Address Line 2, City, and State inputs from the Form Editor if desired.
    3. Install accompanying gpaa-autocomplete-zip.js snippet

Code

Filename: gpaa-autocomplete-zip.php

<?php
/**
 * Gravity Perks // GP Address Autocomplete // Show ZIP 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 to the Form ID and FIELDID to the Address Field ID.
 *     3. Hide the Address Line 1, Address Line 2, City, and State inputs from the Form Editor if desired.
 *     4. Install accompanying gpaa-autocomplete-zip.js snippet
 */
add_filter( 'gpaa_init_args_FORMID_FIELDID', function( $args ) {
	$args['inputSelectors']['autocomplete'] = '#input_FORMID_FIELDID_5';

	return $args;
});

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.