APIs & Integrations

MadhumithaR
Member

Non hubspot forms - Rename issue

SOLVE

We have a non-HubSpot form where.Initially, form submissions were collected under a name created from Tailwind CSS classes (e.g., "w-full, grid").We renamed the form to be more meaningful (e.g., "contactForm.Now new submissions are appearing under "contactForm234234341" (with random numbers).We need all submissions - both old and new - to appear under one meaningful form name

Need solution to consolidate submissions under a single, meaningful form name.

0 Upvotes
1 Accepted solution
Jake_Lett
Solution
Guide | Partner
Guide | Partner

Non hubspot forms - Rename issue

SOLVE

Thanks for the heads up on this @Jaycee_Lewis 

This is something I have wondered about myself because I have a WordPress site with active campaign forms embedded. The form ID is dynamic and so I have a ton of unique forms in my HubSpot account. I noticed if you remove the ID and CSS and set a new ID you can have more control over how it is named.

 

So you would need to write some javascript to clear the dynamic ID and set a new ID that stays static on each payload. This works but you need to test to make sure your form still works with the ID change. If so, you should be good but if not I don't see a way around this except using the HubSpot API to submit form submissions instead of the default tracking script.

 

document.addEventListener("DOMContentLoaded", function () {
    var form = document.querySelector("form"); // Adjust selector if needed

    if (form) {
        // Remove existing form ID
        form.removeAttribute("id");

        // Remove all existing classes
        form.className = "";

        // Get the page slug (last part of the URL path)
        var pageSlug = window.location.pathname.split("/").filter(Boolean).pop() || "home"; 

        // Set new form ID
        var newFormId = "contactForm_" + pageSlug;
        form.setAttribute("id", newFormId);
    }
});

 

Jake_Lett_0-1738752197363.png

 

View solution in original post

0 Upvotes
2 Replies 2
Jake_Lett
Solution
Guide | Partner
Guide | Partner

Non hubspot forms - Rename issue

SOLVE

Thanks for the heads up on this @Jaycee_Lewis 

This is something I have wondered about myself because I have a WordPress site with active campaign forms embedded. The form ID is dynamic and so I have a ton of unique forms in my HubSpot account. I noticed if you remove the ID and CSS and set a new ID you can have more control over how it is named.

 

So you would need to write some javascript to clear the dynamic ID and set a new ID that stays static on each payload. This works but you need to test to make sure your form still works with the ID change. If so, you should be good but if not I don't see a way around this except using the HubSpot API to submit form submissions instead of the default tracking script.

 

document.addEventListener("DOMContentLoaded", function () {
    var form = document.querySelector("form"); // Adjust selector if needed

    if (form) {
        // Remove existing form ID
        form.removeAttribute("id");

        // Remove all existing classes
        form.className = "";

        // Get the page slug (last part of the URL path)
        var pageSlug = window.location.pathname.split("/").filter(Boolean).pop() || "home"; 

        // Set new form ID
        var newFormId = "contactForm_" + pageSlug;
        form.setAttribute("id", newFormId);
    }
});

 

Jake_Lett_0-1738752197363.png

 

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

Non hubspot forms - Rename issue

SOLVE

Hi, @MadhumithaR 👋 Welcome to our community! Thanks for your post. I'd like to invite some of our community members to the converstaion — hey @BarryGrennan @TomM2 @Jake_Lett, do you have any suggestions or other thoughts on this issue for @MadhumithaR?

 

Thank you very much for taking a look! — Jaycee


Join us on March 27th at 12 PM for the Digital Essentials Lab, an interactive session designed to redefine your digital strategy!
Engage with expert Jourdan Guyton to gain actionable insights, participate in live Q&A, and learn strategies to boost your business success.
Don't miss this opportunity to connect and grow—reserve your spot today!


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !
0 Upvotes