Yes, this is possible. It will require a few steps in a few different places.
In your Form:
- Create a Form with an Invisible Field (handle:
invisibleEmailField
)
- Set the
Invisible Field Value
setting to match the value of a hidden email Field Variable (that you will define in your Twig Templates below: {secretEmailAddress}
)
In your Notification Email:
- Set the Recipient field to the handle of your Invisible Field
{invisibleEmailField}
In your Section:
- Create an Email Address Field (handle:
notificationEmail
, type: Plain Text Field or Email Field)
- Create a Form Relations Field (handle:
selectedForm
, type: Form Relations Field)
- Define the email address you wish to use in your Plain Text field
- Create a relationship to your form
In your Twig Template:
Use the addFieldVariables
tag to make your Entry's Email Address value available to your Invisible Field. Your page template would look something like the following:
{# Use the addFieldVariables tag to make variables
available to the Invisible Field settings
This tag has to come before the `displayForm` tag. #}
{% do craft.sproutForms.addFieldVariables({
'secretEmailAddress': entry.notificationEmail
}) %}
{% set formHandle = entry.selectedForm.one().handle %}
{# Output the Form selected in your Form Relations field #}
{{ craft.sproutForms.displayForm( formHandle ) }}
When this form is submitted, the secretEmailAddress
value is available to be processed by your Form's Invisible Field. And when the Notification Email is triggered, the Notification Email has access to the submitted Form Entry which has your custom Invisible Field.