Skip to content

Commit

Permalink
gpaa-use-full-street-address.js: Added snippet to use full street a…
Browse files Browse the repository at this point in the history
…ddress for countries like Poland.
  • Loading branch information
saifsultanc authored Nov 14, 2023
1 parent 0867ddf commit 3ba10e5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions gp-address-autocomplete/gpaa-use-full-street-address.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Gravity Perks // GP Address Autocomplete // Use Full Street Address
*
* For some countries like Poland, when entering an address with a street number,
* the place result may sometimes truncate it. This snippet will prepend the street number if it is not
* included in the result.
*
* http://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.
*/
window.gform.addFilter('gpaa_values', function(values, place, instance) {
var fullAddress = instance.inputs.address1.value;
values.address1 = fullAddress.split(',')[0].trim();
return values;
});

0 comments on commit 3ba10e5

Please sign in to comment.