2

I need to include the contents of a hidden field in my form's notification emails. I know the field value is being captured, as I can see it in the CP, but it's not included in the emails.

I thought maybe I needed to create custom template, but the path to the default Sprout Email templates in the docs is no longer accurate.

I'm using Sprout Forms 3.0.0-beta.44 and Craft 3.1.14

1 Answer 1

3

By default, several fields do not display in the default Email Template such as the Hidden Field, Invisible Field, Section Heading Field, Private Notes Field, and Custom HTML field.

If you'd like to display any or all of those fields, you can override the default email template by in your Notification Email settings. Select the "Custom Templates" option and add a path to a folder in your template folder where you will place your email.twig override file. More info on Notifications and Email Template overrides in our docs.

You can copy the default Email Template as a starting point and the line that you'll want to update is {% for field in fields if not field.isPlainInput() %} which you can see here.

You can remove the if not field.isPlainInput() condition in that for loop to display all fields in your email. And conditionally hide or handle other fields uniquely in your templates by targeting them by their unique folder name: field.getFieldInputFolder().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.