Capture Neighborhood Seperately

Code

Filename: gpaa-capture-neighborhood-separately.js

/**
 * Gravity Perks // Address Autocomplete // Capture Neighborhood Seperately
 * https://gravitywiz.com/documentation/gravity-forms-address-autocomplete/
 */
gform.addAction('gpaa_fields_filled', function (place, instance, formId, fieldId) {
	place.address_components.forEach( function( component ) { 
		if ( component.types.indexOf( 'neighborhood' ) !== -1 ) {
    	// Update "4" to the field ID in which you would like to capture the Neighborhood.
			$( '#input_GFFORMID_4' ).val( component.long_name );
		}
	} );
	return place;
} );

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.