Help adding Contact form with multiple contact

I have an issue adding a second contact form to the same page
I tried to follow this: Frontend Forms | Grav Documentation

forms:
    contact-form:
        fields:
            ...
        buttons:
            ...
        process:
            ...

    newsletter-form:
        fields:
            ...
        buttons:
            ...
        process:

but without success, maybe very simple, missing something

was trying to set up something like this:
user can toggle the form or option to select like user1 or user2
form1 goes recipient or user 1
form2 goes recipient or user 2

hope someone can put me in the right direction Thank you

Is anyone having similar issues?

What do you have so far? What exactly is not working (form sent to wrong recipient, wrong form displayed, …)? What do you have in your forms’ process configs?

the signal form works fine, I was trying to set up multiple selection options
example:
user can toggle the form selection or option:
select Info
email should go to recipient info@mysite.com

If form selection or option:
select sales
email should go to recipient sales@mysite.com

When I test, it goes to default email on the system, I am able to add another recipient, but that’s not what I want. I want info to go to info@mysite.com and sales go to sales@mysite.com

Thank you

If I understand what you’re saying, you have a select with two options whom to contact. Depending on selected option, email should be sent to different recipient. If so, just use <option value="sales@mysite.com">Sales</option>

And in process field use something like

process:
    - email:
        to: "{{ form.value.contact_email|e }}"

It’s in the docs

Can’t give more detailed answer without knowing how your select field is set up

I had looked at document, but was little confused, I think I was mixing something, but I will test and update if this works out Thank you

Dynamic email attribute

If you want for example to set the email.from field from a Form input, you can get its content and use it in this way:

from: "{{ form.value.email|e }}"

In this case, we get the field “email” from the form, and use it for the “from” attribute. This way the site owner will receive an email and will be able to directly reply to the email entered in the form.

@ramraj, To save you some time, you might want to give the following form definition a try:

---
form:
  name: contact
  fields:
    topic:
      type: select
      options:
        'marketing@mysite.com': General information
        'sales@mysite.com': Sales information
  buttons:
    submit:
      type: submit
      value: Submit
  process:
    email:
      subject: 'Site Contact Form'
      body: "{% include 'forms/data.html.twig' %}"
      to: '{{ form.value.topic|e }}'
---
1 Like

@Karmalakas @anon76427325
it works Thank you very much for your help

A post was split to a new topic: How to use ‘text’ of Select field in Form as subject of email