Two forms on modular page - how?

I have two forms on a modular page - a newsletter form and a contact form. I’ve used form 2.0 plugin and it was working fine when I initially set it up for the contact form, but when I created files for the newsletter everything collapsed. Now the contact form is displaying data (input field ‘email’ and ‘submit’ button) of the newsletter form and the newsletter form is not displaying any. Has anyone else experienced a similar problem?

I’m trying to render them by calling the adequate form (as advised here):

Contact Form

{% include “forms/form.html.twig” with { form: forms(‘contact-form’) } %}

Newsletter Signup

{% include “forms/form.html.twig” with { form: forms(‘newsletter-form’) } %}

I’ve tried to follow as advised here about forms on a modular page. However, it’s working only if I have one form. If I add the second one, the first is not displaying where it supposed to. It’s displayed where the second should be and the second one is not displaying at all.

Where are you forms defined, and what does that look like? Please use code blocks to paste your YAML form definitions.

These are not blueprints, therefore they’re not in yaml file. I’m talking about front-end forms, for example contact form. I see some common confusion here, perhaps there should be more distinction between one and another.

Frontend forms are defined in YAML frontmatter of the page just like a back end blueprint. Here’s an example I have lying around:

---
menu: Columns Test
cache_enable: false
form:
    name: columns-form
    refresh_prevention: false

    fields:
        columns:
            type: columns
            
            fields:
                column0:
                    type: column
                    
                    fields:
                        firstname:
                            label: FIRSTNAME
                            default: FIRSTNAME_PLACEHOLDER
                            autocomplete: on
                            type: text
                            validate:
                                required: true

                column1:
                    type: column
                    
                    fields:
                        lastname:
                            label: SURNAME
                            default: SURNAME_PLACEHOLDER
                            autocomplete: on
                            type: text
                            validate:
                                required: true
    buttons:
        submit:
            type: submit
            value: SUBMIT
    process:
        save:
            fileprefix: contact-
            dateformat: Ymd-His-u
            extension: csv
            body: "{% include 'forms/data.txt.twig' %}"
            operation: create
        message: 'Success!'
        display: '/form/landing'
---

# Contact
1 Like

Thanks, now I just need to remove the loop in the html.twig file and it should work.

I’ve actually didn’t have to remove the loop. Just inspected the classes and changed css.