Skip to content

Commit

Permalink
~added instruction video (gravitywiz#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
levisimon authored Apr 18, 2022
1 parent 0a0e909 commit fe7bb5a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions gp-address-autocomplete/gpaa-use-short-name-for-province.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
* Gravity Perks // Address Autocomplete // Always Use Short Name for State / Province / Region
* https://gravitywiz.com/documentation/gravity-forms-address-autocompate/
*
* This was develope for a customer using Address Autocomplete in Italy. The province was retuned as
* Instruction Video: https://www.loom.com/share/f39708854d504d32902b5fca29e73213
*
* This was develope for a customer using Address Autocomplete in Italy. The province was retuned as
* "Città Metropolitana di Torino" where they wanted to use the province code instead (e.g. "TO").
*/
gform.addFilter( 'gpaa_values', function( values, place ) {
for ( var i = 0; i < place.address_components.length; i++ ) {
var component = place.address_components[i];
if ( component.long_name === values.stateProvince ) {
values.stateProvince = component.short_name;
}
}
return values;
} );
gform.addFilter("gpaa_values", function (values, place) {
for (var i = 0; i < place.address_components.length; i++) {
var component = place.address_components[i];
if (component.long_name === values.stateProvince) {
values.stateProvince = component.short_name;
}
}
return values;
});

0 comments on commit fe7bb5a

Please sign in to comment.