<blockquote>
  <p>But, is it possible to do this when there is another contact form on the site? </p>
</blockquote>

<p>Yes?</p>

<blockquote>
  <p>If so, what do I need to add to the department dropdown code?</p>
</blockquote>

<p>The dropdown code shouldn't have anything to do with it, if I'm following you correctly.</p>

<p>Both forms just need to have a <code>toEmail</code> hidden input as specified in the docs: <a href="https://github.com/pixelandtonic/ContactForm#dynamically-adding-email-recipients-requires-craft-25" rel="nofollow noreferrer">https://github.com/pixelandtonic/ContactForm#dynamically-adding-email-recipients-requires-craft-25</a></p>

CC BY-SA 3.0
2017-05-06T07:04:22.627Z
@Stak you can set the `toEmail` value using JavaScript on change of the selected dropdown option. It's probably also possible to dynamically set/override the data from a `contactForm.beforeSend` event listener.
carlcs
CC BY-SA 3.0
2017-02-05T10:49:04.213Z
Great news! So on the dropdown feature, is it possible to have multiple different "toEmail" options, depending on which business they would like the message to go to?
Stak
CC BY-SA 3.0
2017-02-05T00:28:18.080Z
2017-02-05T00:28:18.080Z
Brad Bell
<p>I'm creating a website that has a contact form on two different pages.</p>

<p>I am using the Pixel &amp; Tonic <a href="https://github.com/pixelandtonic/ContactForm" rel="nofollow noreferrer">ContactForm plugin</a> and currently have a working contact form on one page - This one requires the user to provide their name, email, telephone, company name and message.</p>

<p>On the other page, the contact form is different as the user needs to select which department they would like their message to be sent to. For example:</p>

<pre><code>  &lt;div class="select-wrapper"&gt;
   &lt;select name="department" id="department"&gt;
    &lt;option value=""&gt;- Please Select -&lt;/option&gt;
      &lt;option value="one"&gt;Business One&lt;/option&gt;
      &lt;option value="two"&gt;Business Two&lt;/option&gt;
      &lt;option value="three"&gt;Business Three&lt;/option&gt;
      &lt;option value="four"&gt;Business Four&lt;/option&gt;
   &lt;/select&gt;
 &lt;/div&gt;
</code></pre>

<p>In the README document for this plugin, I can see that it is possible to programatically add email recipients by adding a hidden input field named “toEmail” and changing the craft/config/contactform.php config file</p>

<p>But, is it possible to do this when there is another contact form on the site?
If so, what do I need to add to the department dropdown code?</p>

<plugin-contactform>
Multiple contact forms - Different recipients
# Multiple contact forms - Different recipients

(Asked by: username_0 on 2017-02-04)

I'm creating a website that has a contact form on two different pages.
I am using the Pixel & Tonic ContactForm plugin and currently have a working contact form on one page - This one requires the user to provide their name, email, telephone, company name and message.
On the other page, the contact form is different as the user needs to select which department they would like their message to be sent to. For example:
  
   
    - Please Select -
      Business One
      Business Two
      Business Three
      Business Four
   
 

In the README document for this plugin, I can see that it is possible to programatically add email recipients by adding a hidden input field named “toEmail” and changing the craft/config/contactform.php config file
But, is it possible to do this when there is another contact form on the site?
If so, what do I need to add to the department dropdown code?

**Tags:** plugin-contactform


---

## 1 answers

### Answer by username_1 on 2017-02-05. Score: 3

> But, is it possible to do this when there is another contact form on the site?

Yes?

> If so, what do I need to add to the department dropdown code?

The dropdown code shouldn't have anything to do with it, if I'm following you correctly.

Both forms just need to have a `toEmail` hidden input as specified in the docs: <https://github.com/pixelandtonic/ContactForm#dynamically-adding-email-recipients-requires-craft-25>

> **Comments:**
> **username_0**: Great news! So on the dropdown feature, is it possible to have multiple different "toEmail" options, depending on which business they would like the message to go to?  
> **username_2**: @username_0 you can set the `toEmail` value using JavaScript on change of the selected dropdown option. It's probably also possible to dynamically set/override the data from a `contactForm.beforeSend` event listener.  

---

