SOLVED

Re: Marketo Form onSuccess never fires

Go to solution
eat-sleep-code
Level 1

Marketo Form onSuccess never fires

I have the following code to place a form.   When I fill out all the fields and submit it, I see the 'Submitting...' in the console log, but that is it.   I never see 'Submitted' and there are no errors in the console.

 

 

 

 

<html>

<head>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</head>

<body>
	<div class="by-marketo">
		<form id="mktoForm_12695"></form>
	</div>
	<script>
		const marketoFormsScriptTag = document.createElement('script');
		marketoFormsScriptTag.src="https://now.EXAMPLE.com/js/forms2/js/forms2.min.js";
		marketoFormsScriptTag.setAttribute('charset', 'utf-8');
		marketoFormsScriptTag.onload = function () {
			window.MktoForms2.loadForm("//now.EXAMPLE.com", "XXX-XXX-XXX", 12695, function (form) {
				console.log('Element', form.getFormElem());
				//MktoForms2.lightbox(form).show();
				form.onSubmit(function () {
					console.log('Submitting...', form);
				}).onSuccess(function (values, followUpUrl) {
					console.log('Submitted');
					form.getFormElem().hide();
					form.getFormElem().parent().html('<div class="by-marketo-form-confirmation"><p>Thank you for getting in touch! We appreciate you contacting us and we will respond within two business days with more information.</p></div>');
					return false;
				});

			});
		}
		document.head.appendChild(marketoFormsScriptTag);
	</script>
</body>

</html>

 

 

 

 

 

As far as how I generating the script tag, that is because this will eventually be in a Vue.js app.   I pulled it out in a standalone page to make sure that nothing Vue.js was conflicting with it, but I get the same behavior.


Ideas?

Tags (1)
2 ACCEPTED SOLUTIONS

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo Form onSuccess never fires

eat-sleep-code
Level 1

Re: Marketo Form onSuccess never fires

What the heck??   Would my local development environment running on HTTP instead of HTTPS cause the issue?  Because that is the only I can figure out that might be different.

 

I tried it on http://192.168.1.8:8000 
I see the same behavior as before, so the only thing I can think of would be.

 

EDIT: Yup, appears to be it.   Now off to figure out how the heck to get Gridsome's local dev server to run on HTTPS. 

View solution in original post

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo Form onSuccess never fires

Not sure the reasons for removing those are so obvious. We need to see a page where this is failing to troubleshoot it for you.

eat-sleep-code
Level 1

Re: Marketo Form onSuccess never fires

Updated to include the account info.

SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo Form onSuccess never fires

eat-sleep-code
Level 1

Re: Marketo Form onSuccess never fires

What the heck??   Would my local development environment running on HTTP instead of HTTPS cause the issue?  Because that is the only I can figure out that might be different.

 

I tried it on http://192.168.1.8:8000 
I see the same behavior as before, so the only thing I can think of would be.

 

EDIT: Yup, appears to be it.   Now off to figure out how the heck to get Gridsome's local dev server to run on HTTPS.