Multiple Forms on Single Page
Created 6 years ago by finnito

Hey all, I've got two forms setup {{ forms_display('contact') }} and {{ forms_display('quote') }}. They look very similar but I notice that when I render them out that they both hit the /contact page with a POST request.

I made the quote form first and it seems to work alright, and I've just made the contact form but for some reason it doesn't seem to be sending. It appears to complete without any errors but nothing shows up in my mail log file.

Is there any issues with conflicting forms or am I just missing something simple?

ryanthompson  —  6 years ago Best Answer

You will need to specify a prefix for the forms. Which means you won't be able to use the forms_display method.

{{ form('forms::contact').setOption('prefix', 'contact_').get()|raw }}

Should do it. You only have to prefix one but you can copy and change for the other one if you want too!

finnito  —  5 years ago

Yes thank you! Sorry to accidentally duplicate this question.