Form ID pulled from CMS data

It would be great to be able to have the form ID take its name from the CMS so that if we use a form on a landing page that is used multiple times, we know which page the form was filled out on.

1 Like

Hi @LJB, this may not answer your question 100% - but I remember setting up a small script that pulled in the URL of the page that the form was on and included that info in the {formData} when sending a notification:

  $( document ).ready(function() {
    // Populate a hidden field that captures the page URL when submitting a feedback form

Hope this helps a bit - if not, maybe our JS ninja @bart can take a peek? :slight_smile:


@thewonglv @LJB

Webflow.push(function() {
    var landingPageId = window.location.href.replace(window.location.origin, "");
    if(landingPageId == "/") {
        $('#email-form').attr('name', 'Homepage').attr('data-name', 'Homepage');
    } else {
        $('#email-form').attr('name', window.location.href.replace(window.location.origin, "").replace("/", "")).attr('data-name', window.location.href.replace(window.location.origin, "").replace("/", ""));

Notice I have #email-form which is the form ID.