Chaining Forms and accessing values

Hi everyone,

I am trying to build a site with 2 forms. The first form is for the user to enter all relevant information, the 2nd one should be a page displaying the information and a checkbox of the type: ‘are you sure?’

So far I used the display process to go from the 1st to the 2nd form. Using
{% include "forms/data.html.twig" %}
and
{% include "forms/secondForm.html.twig" with { form: forms(secondFormName) } %}
in the template to show the data and add the 2nd form on that page.

My problem is, that a mail should be send after submitting the 2nd form. But the email-adress is entered in the first form, also it should send information from 1st and 2nd form. Is there a trick to do it or will I have to rethink my approach?

I think I’d go with a single form and JS
When user submits first step, JS hides inputs and shows “Are you sure?”. When user submits (s)he is sure, you do full form processing. You have all fields and a single form

A simpler UI/workflow as suggested by @Karmalakas is an excellent idea.

If you are still trying to solve this another way, you can access submitted variables in your target page template (by default, that’s formdata.html.twig but you’ll want to change that) using Twig expressions like form.data['email']. So you could set a hidden form field in your second form and set its value to something like "{{ form.data['email'] }}" then use that in your form’s email action lower down. Make sure twig processing of frontmatter is enabled too. Sorry not tested yet and I can go into more detail if you still need.

You can probably also use the Sequential Form plugin, though it’s probably overkill, possibly outdated, and I have never tried it.