How to auto-populate a text field with postal_code from Google Maps Autocomplete
Support › MB Geolocation › How to auto-populate a text field with postal_code from Google Maps Autocomplete
- This topic has 5 replies, 2 voices, and was last updated 2 hours, 59 minutes ago by
Peter.
-
AuthorPosts
-
April 6, 2026 at 5:07 AM #49888
Jayron Castro
ParticipantHello Meta Box Support Team,
I am looking for the correct technical approach to auto-populate a specific text field with the
postal_codecomponent returned by the Google Maps Autocomplete.My Environment & Current Setup:
- WordPress version: 6.9.4
- Meta Box AIO: Version 3.6.1 (with MB Geolocation active).
- Google Maps API Key is properly configured and restricted. The map renders perfectly.
- Map Field: I have a Google Maps field (ID:
h3_lead_mapa). - Address Field: I have a text field (ID:
h3_lead_endereco) mapped inside the map's "Address field" setting. This works flawlessly: when I search for an address, it populates this text field.
The Goal:
I have a separate text field specifically for the Postal Code (ID:h3_lead_cep). I need this field to automatically receive thepostal_codedata as soon as the map resolves the address.Could you provide the exact syntax or custom setting required to bind the
postal_codeto myh3_lead_cepfield? I am attaching a screenshot of the CPT UI for your reference.Thank you,
Jayron CastroApril 6, 2026 at 9:46 PM #49889Peter
ModeratorHello Jayron,
Thanks for reaching out.
If you have a different field ID from the address component ID
postal_code. You can use the custom binding, following the documentation https://docs.metabox.io/extensions/meta-box-geolocation/#custom-bindingand screenshots https://imgur.com/a/tRVPozs
April 7, 2026 at 12:08 AM #49890Jayron Castro
ParticipantHello Peter,
I have followed the exact procedure you recommended in your last interaction, using the custom binding method as shown in your screenshots, but it did not work.
I added the "binding" key with the "postal_code" value to the Custom Settings of my "h3_lead_cep" field. No other changes were made.
The result is that the field remains empty when an address is selected on the map. I have already cleared the cache and confirmed there are no JavaScript errors in the browser console. The synchronization simply does not happen in my environment (Meta Box AIO 3.6.1).
I am attaching a video and screenshots showing my current configuration and the failure in real-time. Please analyze these materials and provide a solution for this.
Images:April 7, 2026 at 8:39 PM #49892Peter
ModeratorHello,
I'm not able to reproduce the same issue on my site. Please share your site admin account by submitting this contact form https://metabox.io/contact/
I will take a look.April 7, 2026 at 8:52 PM #49894Jayron Castro
ParticipantI submitted the data via the form.
April 7, 2026 at 9:45 PM #49895Peter
ModeratorHello,
I got the issue. You need to add
geo.api_keyto the field group settings and set the address field ID to start withaddress_. Please check this screenshot https://imgur.com/a/MIk8SMy
and follow the documentation https://docs.metabox.io/extensions/meta-box-geolocation/#geolocation-api -
AuthorPosts
- You must be logged in to reply to this topic.