How to get submit button to enable after Google address autofill with (#22 & #48) Memberscript? Answered
Hey guys, anyone used memberscript #48 for address autofill via Google? It looks like Google updated the Places API earlier this year and its stopped new use of the script (message starts "As of March 1st, 2025, google.maps.places.Autocomplete is not available to new customers. Please use google.maps.places.PlaceAutocompleteElement instead."). I'd love to get this working again but not having much luck with my rusty code skills and Rey/ChatGPT/Gemini
Comments
4 comments
Hey Nick Osborn, the following seems to be the base code for the newly updated Places API
I personally haven't tested this out since I can't pay for this api for testing purpose.
But did you have any luck exploring this sample code and modifying the memberscript to accommodate the changes accordingly?
Let me help out a little. Apparently Google created a component library to simplify communication with the API. It would require a small adaptation from the original code. Keep the form component you copied from the Webflow Memberscript the same. We'll only need to update the library and how it interacts with it.
First you need to install the library in the pages where you want the autocomplete component to be. Make sure you remove the old one so it doesn't bloat the page with unused code
Then we'll include the loader and the places picker component in a Embed Code element. Make sure to replace the
keyattribute using your own API key. This part will render the autocomplete component, so make sure to place it where you want your users to interact with ithttps://memberstack.slack.com/archives/C033F0SLTLK/p1750201535560519?thread_ts=1750169469.883769&cid=C033F0SLTLK
Awesome! Thanks Raquel Lopez that works a treat. I had to make sure I had the following APIs added to my GCC project, then all good. Maps JavaScript API, Places API (New), Places API. I've just started using Memberstack and the support is amazing, really pleased i made the choice 🙂 Thank you!
For anyone else using this: if you're also using Memberscript #22 to have the submit button disabled until all fields filled, I found that when all address fields are populated by the Google address lookup script, the listener for form input never fires. Add the following just after postalCodeInput.value = extractPostalCode(place);
//Nudge form to trigger field filled script
const form = document.querySelector('form[ms-code-submit-form]');
form.dispatchEvent(new Event('input', { bubbles: true }));
and it should nudge the button to be activated if all fields are filled.
Please sign in to leave a comment.