Your software
My Mautic version is: 3.3.3
My PHP version is: 7.3.29
My Database type and version is: 10.3.28-MariaDB
Your problem
My problem is:
Dear Mautic Community,
I encountered an issue: if I include a Mautic Form in side a dynamic content block on a landing page, the following JS is not included:
<script type="text/javascript">
/** This section is only needed once per page if manually copying **/
if (typeof MauticSDKLoaded == 'undefined') {
var MauticSDKLoaded = true;
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://mydomain/media/js/mautic-form.js';
script.onload = function() {
MauticSDK.onLoad();
};
head.appendChild(script);
var MauticDomain = 'https://mydomain';
var MauticLang = {
'submittingMessage': "Please wait..."
}
}else if (typeof MauticSDK != 'undefined') {
MauticSDK.onLoad();
}
</script>
therefore the submit button wont change into “Please wait” after submitting the form. And if you select “Successful Submit Action” → “Remain at form” and type in a message, you will get an PHP warning after submitting:
Warning: Invalid argument supplied for foreach()
in Mautic\PageBundle\Model\PageModel->cleanQuery( $query = 'yourMessage' ) .../PageModel.php:597
You can bypass this issue by including a Form directly in the landing page (not inside a dynamic content block). Because then the JS will be loaded inside this form und the form inside the dynamic content field can use it.
Does anybody have an idea why this behaviour occurs?