Streaming live at 10am (PST)

How to add input data in subject line of Webflow form submission

I’ve seen a few users frustrated that there is no way to have a unique identifier in the subject line of a Webflow form - which means you can’t differentiate between emails in the inbox without opening them.

I’ve come up with a really simple fix to this, which allows you to pull any data from a form and use it in the subject line.

Step 1: Set subject line
Go to site settings > forms
Add {{ formName }} in the subject line box

Step 2: Add your custom code
The custom code for this is some simple JavaScript that replaces the Form Name with your chosen form data. Therefore when the Form Name is sent to your email in the subject line, it is instead replaced with your custom form data.

<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>

<script>
$("#name").change(function() {
$(this.form).attr("data-name", this.value);
});
</script>

Replace #name with the ID of the input you want displaying on your subject line.

It’s as easy as that - hope it helps

1 Like

FYI: jQuery is already included with Webflow deployments so no need to add it again. Just place dependent code in the before body area.

An alternative is to simply place a hidden field in your form that has a name and value that identifies the source / purpose.

1 Like

Hi could you elaborate on your proposed alternative? How exactly should we configure this hidden field? This feature has been requested multiple times on the forum, I sure many would find it extremely useful…