Hi Rachel
The intention with the address field is pretty much to enable a marker to be displayed on a Google map at that address.
It uses the Google Maps geocoding service to convert an address into latitude and longitude coordinates for determining the position of the marker, and the stored address text comes from the string returned by the auto-complete service.
Toolset maps uses an intermediary jQuery library (hidden link) which acts as a wrapper for interacting with the Google Maps APIs.
Now, the geocode service does return more information than the address string and coordinates, but these are not used by Toolset Maps, but you can access that information yourself with JavaScript and use it.
You might, for example, add a custom field for the zip code and then automatically populate it from the address look up.
To get you started I set up a test site locally to do the above, automatically updating a custom field (slug "postcode") with the field "postal_code" returned by the Google API when using a post with an address field in the WordPress admin edit screens.
It requires adding some custom Javascript to your site which needs to be available on the admin pages, so you will need to add the code to a file which you enqueue with admin_enqueue_scripts. In my case I added the following to my theme's functions.php file to enqueue a file custom-map.js in the specified location.
/**
* Enqueue JS file custom-map.js on admin pages
*
*/
add_action( 'admin_enqueue_scripts', 'custom_enqueue_admin_scripts' );
function custom_enqueue_admin_scripts(){
wp_enqueue_script( 'custom-map', get_theme_file_uri( '/assets/js/custom-map.js' ), array( 'jquery' ), '1.0', true );
}
The actual content of custom-map.js is:
( function( $ ) {
$( document ).ready( function(){
$("input.js-toolset-google-map").on( "geocode:result", function( event, result ){
var addressComponents = result.address_components,
postal_code = "";
$.each( addressComponents, function( index, value ){
if ( addressComponents[ index ].types[0] == "postal_code" ) {
postal_code = addressComponents[ index ].short_name;
}
} );
$('input[name="wpcf[postcode]"]').val( postal_code );
} );
} );
})( jQuery );
A custom event "geocode:result" is triggered when the geocoding API returns results, and I use that to trigger my code. If you log result to the console you will be able to inspect what the API returns to see what else you can use and how to access it.
Please be aware, though, that this is very much custom code, which falls outside of our support policy, and I can't help you if you are uncomfortable adding it to your site or are unable to modify it to your requirements.