Smart Form subject

I see that I can set the subject of the form submission email, via the Form's "Subject" option (data-bss-subject). However it appears that I can only set this to a static value. I'd like to be able to set it, dynamically, to a value that the user specified on his form (for example: his subject line).

Is this possible?

Thanks.

I know it's just over a year since this was asked, but in case anyone else wants to do this (like me!) it can be done via Javascript.

You need to make 2 changes to the HTML. First, set the ID of the Form so the element can be easily reached (e.g. id="contactform"). Then for the buttons / links across your page, add an onclick attribute calling the set_subject() command (e.g. onclick=set_subject("Contact Us button was pressed").

Lastly you need to add a simple piece of Javascript in your JS file:

function set_subject(subject) {
document.getElementById("contactform").setAttribute("data-bss-subject", subject);
}

Hope that's useful to someone else in future.

1 Like