Rebuilding Database Query Form in Hubspot

Howdy Developers!

I’m looking to recreate the form on this page (Sales and Distributors | Amphenol Advanced Sensors) using HubL and HubDB instead of PHP like on the current version of this application.

I’m a bit new to this type of HubL so I am not completely sure what is possible and what isn’t. I had initially started with trying to store the selected option in JS and then pass it to HubL variables which could then be used to query the HubDB table.

Is creating something like the above possible? If so, are there any resources that cover this topic I can use as reference.

Any help is greatly appreciated!

Hey @DPicklo

I feel like this is a good question for @alyssamwilie

@DPicklo

You can’t use javascript inside HubL since HubL runs before javascript does. You would need to send the variable into a URL parameter or use javascript to do the filtering. Here’s a tutorial that uses select boxes and URL parameters to filter HubDB data - GitHub - HubSpot/cms-custom-objects-example · GitHub

In 2025, this kind of HubDB form build is more approachable than it was a few years back.

You’re right that HubL itself can’t “listen” for JS values since it runs server-side, but the pattern has matured: today most developers use HubDB with dynamic filters passed as query parameters, and then handle the selection logic purely in JavaScript.

The HubL template just reads from those URL params when rendering the HubDB query. HubSpot’s docs cover how to query HubDB with filters and parameters here:

(HubDB - HubSpot docs )

The other big change since 2023 is that HubSpot CMS now supports serverless functions and CRM object APIs more cleanly within CMS pages, which means you can offload heavier query logic there instead of embedding all the complexity in HubL.

For a distributor lookup like the one you linked, that’s often a better long-term route: keep HubL for rendering, use a HubSpot function for the query, and JavaScript for the UI. That keeps your form reactive without fighting HubL’s limitations.

If the goal is to make it production-ready for 2025, I’d recommend mocking your HubDB schema carefully (region, distributor type, etc.) and testing URL-based filtering with simple selects before wiring up serverless functions. This gives you a smooth path to scale later if you need real-time sync with another database. If consistency between HubDB and your source database becomes the next challenge, Stacksync keeps those datasets mirrored in both directions automatically, so you don’t have to rebuild custom sync logic yourself

Hope this helps you frame the approach for today’s HubSpot CMS environment.