How to Verify Address, City, ZIP Code, State, and Country on HubSpot Form Submit Using Google Places API

April 14, 2025 1664293928114 Jonathan Sumner

Collecting address data via autocomplete is powerful — but what happens after a user submits a HubSpot form?

** This is a follow up article to setting up address and location autocomplete fields on HubSpot forms. Looking to use location autocomplete on HubSpot forms? check out: Smart Address Autocomplete in HubSpot Forms Using Google Places API

Collecting address data via autocomplete is powerful — but what happens after a user submits a HubSpot form? Autocomplete can still yield incomplete or improperly formatted data. That’s where post-submit verification and standardization come in.

This follow-up guide shows how to use the Google Places API to verify and normalize address information after a form is submitted in HubSpot — keeping your CRM clean, campaigns accurate, and sales territories aligned.

Why Post-Submission Address Verification Matters

Autocomplete improves UX, but it doesn't guarantee:

  • A fully valid address (especially if users bypass or edit fields)
  • Standardized formatting (e.g., "NY" vs. "New York")
  • Country-specific accuracy (e.g., postal codes in UK vs. US)

Post-submit verification ensures that:

  • ZIP codes match cities
  • Country names are canonical
  • State abbreviations are consistent
  • Missing values can be inferred or corrected
  • You can detect invalid combinations (e.g., state doesn’t match country)

Use Case: Validate a HubSpot Contact's Address Using Google Places API After Submission

There are two main ways to run verification:

1. Client-Side Verification Immediately on Form Submit

Validate the address in real-time before sending the form to HubSpot.

Pros:

  • Fast feedback to user
  • Prevents bad data from entering the CRM

Cons:

  • Can be bypassed or blocked by the browser
  • Doesn’t apply to prefilled values (like progressive profiling)

2. Serverless Post-Submit Verification via Webhook or Workflow Action

After submission, use a HubSpot workflow to send data to a webhook that validates the address with Google Places API, then updates the contact.

Pros:

  • Works on all submissions
  • Can enrich existing contacts later
  • Fully transparent to the user

Cons:

  • Requires a small backend (can be done with HubSpot serverless functions or middleware like Make/Zapier)

Option 1: Client-Side Validation Before Submit

Extend your existing custom module with a function to validate the address on submit:

function validateAddressWithGoogle(callback) {
  const address = document.getElementById("autocomplete").value;
  const geocoder = new google.maps.Geocoder();

  geocoder.geocode({ address }, (results, status) => {
    if (status === "OK" && results[0]) {
      const components = results[0].address_components;

      const getComponent = (type) =>
        components.find(c => c.types.includes(type))?.long_name || "";

      // Replace field values with verified values
      document.getElementById("city").value = getComponent("locality");
      document.getElementById("state").value = getComponent("administrative_area_level_1");
      document.getElementById("zip").value = getComponent("postal_code");
      document.getElementById("country").value = getComponent("country");

      callback(true);
    } else {
      alert("Unable to verify the address. Please double-check.");
      callback(false);
    }
  });
}

Hook it into the form’s submit handler:

document.querySelector("form").addEventListener("submit", function (e) {
  e.preventDefault(); // stop immediate submission
  validateAddressWithGoogle((isValid) => {
    if (isValid) this.submit(); // only submit if verified
  });
});

Option 2: Server-Side Verification with HubSpot Workflows + Webhook

  1. Create a Custom Workflow Trigger
  • Trigger when a contact submits your form (or any form with address info)
  1. Add a Webhook Action
  • Send address, city, state, ZIP, country to a webhook endpoint
  1. Build a Verification Microservice
  • Use Node.js, Python, or HubSpot Serverless Functions
  • Receive the data and query Google’s Geocoding API:
GET https://maps.googleapis.com/maps/api/geocode/json?address=123+Main+St,+City,+State&key=YOUR_API_KEY
  • Parse and compare fields
  • Return cleaned-up values
  1. Update the Contact
  • Use HubSpot’s API or workflow webhook response to update the contact

Testing & Quality Checks

  • Test your workflow with test submissions using known-good and known-bad data
  • Review HubSpot contact records to confirm updated/verified values
  • Check Google’s usage limits and enable billing to avoid quota issues

Data Enrichment Tips

  • Use Google’s response to fill in missing city/state/ZIP from partial addresses
  • Use a fallback address if the entered one is invalid
  • Cross-check with your sales territory lists for dynamic routing

Final Thoughts

Combining autocomplete before submit with post-submit verification gives you the best of both worlds:

  • Seamless user experience
  • Clean, normalized, and enriched CRM data

This ensures every contact has actionable location data — ideal for geo-targeted campaigns, sales assignments, or international compliance.

Ready to Implement It?

Already using our custom module for autocomplete? This guide plugs right into your existing setup.

Need help implementing serverless workflows, webhooks, or data enrichment? Get in touch — we build and integrate custom HubSpot solutions for smarter forms, cleaner data, and better lead routing.

Return to blog

Related Posts

How to Deploy Cookiecutter Django on a DigitalOcean Droplet (Ubuntu 22.04)

April 15, 2025 | 1664293928114 Jonathan Sumner

This guide walks you through the full process — from droplet setup to live deployment — following modern best practices for security and performance.

Smart Address Autocomplete in HubSpot Forms Using Google Places API

April 13, 2025 | 1664293928114 Jonathan Sumner

Collecting accurate address information from leads is critical for many businesses — from territory assignment to geo-targeted campaigns.

How to automate scheduling links for Facebook Lead Ads using Zapier, OpenPhone, Gmail API, and Calendly.

April 13, 2025 | 1664293928114 Jonathan Sumner

Automating Appointment Booking with Facebook Lead Ads, Zapier, OpenPhone, Gmail API, and Calendly