<p>Yes, this is possible. It will require a few steps in a few different places.</p>

<p>In your Form:</p>

<ul>
<li>Create a Form with an Invisible Field (handle: <code>invisibleEmailField</code>)</li>
<li>Set the <code>Invisible Field Value</code> setting to match the value of a hidden email Field Variable (that you will define in your Twig Templates below: <code>{secretEmailAddress}</code>)</li>
</ul>

<p>In your Notification Email:</p>

<ul>
<li>Set the Recipient field to the handle of your Invisible Field <code>{invisibleEmailField}</code></li>
</ul>

<p>In your Section:</p>

<ul>
<li>Create an Email Address Field (handle: <code>notificationEmail</code>, type: Plain Text Field or Email Field)</li>
<li>Create a Form Relations Field (handle: <code>selectedForm</code>, type: Form Relations Field)</li>
<li>Define the email address you wish to use in your Plain Text field</li>
<li>Create a relationship to your form</li>
</ul>

<p>In your Twig Template:</p>

<p>Use the <code>addFieldVariables</code> tag to make your Entry's Email Address value available to your Invisible Field. Your page template would look something like the following:</p>

<pre><code>{# 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 ) }}
</code></pre>

<p>When this form is submitted, the <code>secretEmailAddress</code> 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.</p>

CC BY-SA 4.0
2019-02-18T04:20:14.097Z
Ok, so the client will have to add new forms to the notification email every time they create a new one. Unless, they just use the same form every time, mmm. As I don't think the fields change every time per Lead Form. Sorry, thinking out loud, lol.

Thanks a mil Ben! :)
Nicole Lambon
CC BY-SA 4.0
2019-02-18T07:48:49.310Z
I seem to be running into an issue. When I try and add the field to the recipient email field I get the following error.
`Dynamic {invisibleEmailField} attribute does not exist.`

I have added the field to the form as instructed. Also the value of the hidden field doesn't seem to pull through, is this correct?
Nicole Lambon
CC BY-SA 4.0
2019-02-24T22:56:15.233Z
The above issue was a bug and is resolved now.
Ben Parizek
CC BY-SA 4.0
2019-06-26T08:31:16.383Z
I have a question with regards to this. Is it supposed to save the data to Sprout Forms in the field that has been created? As it isn't saving anything to the form field.
Nicole Lambon
CC BY-SA 4.0
2019-06-27T13:02:46.003Z
@NicoleLambon Yes. The Invisible Field will store a value that you submit to it. If it's not saving, it's possible you have a syntax error. The easiest way to test if it's working would be to just hard code a "test" value to be saved in the field. If you have questions about syntax, consider opening a new question and providing a few more details about what you have set up and are trying to do and we will figure out what's going on.
Ben Parizek
CC BY-SA 4.0
2019-06-27T13:53:06.517Z
I have setup the form etc exactly as specified above and have tried the test with the hard coded value, and it's not saving anything to the form. So I will open a new question.
Nicole Lambon
CC BY-SA 4.0
2019-02-17T22:31:09.723Z
2019-02-17T22:31:09.723Z
Ben Parizek
<p>I have an entry where I select which form displays on the page. Is there a way for me on the entry using a text input for an email address to use that email address for the sending of emails via the sprout form?</p>

<p>So in other words, I have an entry with a selected Sprout Form as well as an email address filled out in the entry, where the selected Sprout Form needs to send the email to. e.g. a hidden field where I can add the email address to, etc.</p>

<p>Any help would be great, thanks.</p>

<craft3><plugin-sproutforms>
Sprout Forms Email
# Sprout Forms Email

(Asked by: username_0 on 2019-02-17)

I have an entry where I select which form displays on the page. Is there a way for me on the entry using a text input for an email address to use that email address for the sending of emails via the sprout form?

So in other words, I have an entry with a selected Sprout Form as well as an email address filled out in the entry, where the selected Sprout Form needs to send the email to. e.g. a hidden field where I can add the email address to, etc.

Any help would be great, thanks.

**Tags:** craft3, plugin-sproutforms

---

## 1 answers

### Answer by username_1 on 2019-02-17. Score: 2 | Accepted answer

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.

> **Comments:**
> **username_0**: Ok, so the client will have to add new forms to the notification email every time they create a new one. Unless, they just use the same form every time, mmm. As I don't think the fields change every time per Lead Form. Sorry, thinking out loud, lol.  Thanks a mil Ben! :)  
> **username_0**: I seem to be running into an issue. When I try and add the field to the recipient email field I get the following error. `Dynamic {invisibleEmailField} attribute does not exist.`  I have added the field to the form as instructed. Also the value of the hidden field doesn't seem to pull through, is this correct?  
> **username_1**: The above issue was a bug and is resolved now.  
> **username_0**: I have a question with regards to this. Is it supposed to save the data to Sprout Forms in the field that has been created? As it isn't saving anything to the form field.  
> **username_1**: @NicoleLambon Yes. The Invisible Field will store a value that you submit to it. If it's not saving, it's possible you have a syntax error. The easiest way to test if it's working would be to just hard code a "test" value to be saved in the field. If you have questions about syntax, consider opening a new question and providing a few more details about what you have set up and are trying to do and we will figure out what's going on.  
> **username_0**: I have setup the form etc exactly as specified above and have tried the test with the hard coded value, and it's not saving anything to the form. So I will open a new question.  

---

