Forum

Thread tagged as: Question, Forms

Add variable to Forms App subject line

A client of mine is complaining that the subject line of all contact form emails is the same, which is causing them to be grouped into one thread by his email client. He's asking if it would be possible to add a timestamp to the subject line. Is it possible to add a variable into the subject using the Forms app?

Shane Lenzen

Shane Lenzen 18 points

  • 6 years ago

I think in form settings you put the field id in curly braces

{fieldID}

Yes you can add any variable from the form by using the name of the field in curly braces.

For example on a job application form I have the following:

Job Application from {name} for {title}

But I am not sure how you would add a timestamp, as that is not a field from the submitted form

Yes. You could add a time stamp to the form via a hidden field in your template which would then be available in the forms POST variable. Then using curly brackets apply to the subject of the email.

Something like this perhaps:

<perch:input type="hidden" id="datetime" name="datetime" value="<?php echo date("D M j G:i:s Y") ?>" />

Though I am not sure if this will work!

You cannot include PHP tags within a template. In a little while when I'm at my desk I will put together a sample unless somebody else beats me to it

Had no idea about the curly brackets. Problem solved. Thanks everyone!

Shane Lenzen said:

Had no idea about the curly brackets. Problem solved. Thanks everyone!

Sure thing. I'm glad you worked it out. :)

Is it documented anywhere in Perch Docs that you can use {curly brackets} and IDs in Form Options? I had to do a bit of searching before I found this forum post.