Score:0

Drupal modal does not render remote forms (Mautic)

ru flag

I'm trying to embed Mautic forms in my drupal site. I created a controller pointing to '/mautic-form` and in the twig template I have this:

<script type="text/javascript" src="//mautic.coachingrealista.com/mautic/form/generate.js?id=3"></script>

enter image description here

When I go to that page (/mautic-form), the form renders well: enter image description here

But when I use it inside a modal, it does not render that form:

<a data-dialog-options="{&quot;width&quot;:800}" data-dialog-type="modal" href="/mautic-form" class="use-ajax">LEARN MORE</a>

enter image description here

I looked on the JS console and I didn't see any error.

It's doing fine with the requests: enter image description here

What am I doing wrong?

berliner avatar
bd flag
Just wanted to give some feedback: I see you already posted this as a bug to mautics github issue. Just tested it on one of my local sites and I can also confirm that the form itself is rendered in the `<head>`when added to a modal.
rpayanm avatar
ru flag
yes, I'll post an answer with a possible solution.
Score:0
ru flag

It looks like that it is a Mautic issue, I posted it in the Mautic GitHub issue: https://github.com/mautic/mautic/issues/10563

Actually, the form is generated but in the head so I did a walkaround moving the form from there to the div where I wanted to be with JS.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.