Multiple email contact forms on single page


I would like to use the “Email contact form” multiple times on a single page, each within a dynamic modal. Each form would need a hidden or pre-filled field with $page->someField() content (such as Subject).

Would a starting point be to use the controller in the cookbook example and modify the $success to allow multiple emails sent instead of the form being disabled after one send?

Any guidance much appreciated!

I’m trying to imagine the use case for one and the same person to send multiple forms from the same page?

Is it always the exact same form apart from a different subject line?

Hello @texnixe thanks for replying.

The use case is within an art gallery website where u will have multiple different artworks on the same page, each with an inquire button that activates a modal with more images and the form.

The idea is that a user could be interested in more than one artwork and would submit multiple forms.

Yes, it would be the exact same form, except one field that would indicate to gallery which artwork they are inquiring about.

If the form is in a modal, you will need some JavaScript and Ajax handling to be able to give feedback inside the modal, because you wouldn’t want the page to reload and close the modal in case of errors. In that case it would maybe make sense to use a content representation or a route to handle the form logic.

Thanks a lot, I will try doing that.