Support

Account

Home Forums Bug Reports Google maps marker won't save values if no address was found

Unread

Google maps marker won't save values if no address was found

  • Since version 5.8.6, Google maps field won’t save custom marker locations if Google Geocoder returns “ZERO_RESULTS” as status. This happens for locations without a known address.

    searchPosition: function( lat, lng ){
    			//console.log('searchPosition', lat, lng );
    			
    			// Start Loading.
    			this.setState( 'loading' );
    			
    			// Query Geocoder.
    			var latLng = { lat: lat, lng: lng };
    			geocoder.geocode({ location: latLng }, function( results, status ){
    			    //console.log('searchPosition', arguments );
    			    
    			    // End Loading.
    			    this.setState( '' );
    			    
    			    // Status failure.
    				if( status !== 'OK' ) {
    					this.showNotice({
    						text: acf.__('Location not found: %s').replace('%s', status),
    						type: 'warning'
    					});
    
    				// Success.
    				} else {
    					var val = this.parseResult( results[0] );
    					
    					// Override lat/lng to match user defined marker location.
    					// Avoids issue where marker "snaps" to nearest result.
    					val.lat = lat;
    					val.lng = lng;
    					this.val( val );
    				}
    					
    			}.bind( this ));
    		},
Viewing 1 post (of 1 total)

The topic ‘Google maps marker won't save values if no address was found’ is closed to new replies.