SOLVED

update forms2 script URL?

Go to solution
RaulEr
Level 4

update forms2 script URL?

Hi, 

Our company is moving to a new CMS tool and they started to test the Mkto forms and they are not loading. When I see the embedded code, it's showing a relative URL instead of an absolute URL. Do I need to change something here or is it something missing in the new test site?

 

<script src="//pages.example.com/js/forms2/js/forms2.min.js"></script> <form id="mktoForm_2633"></form> <script>MktoForms2.loadForm("//pages.example.com", "123-ABC-456", 2633);</script>

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: update forms2 script URL?

You’re simply loading the scripts in the wrong order:

<div class="marketo_form-embed w-embed w-script">
<form id="mktoForm_1574"></form>
<script>MktoForms2.loadForm("//meet.bench.co", "729-JTY-427", 1574);</script></div>
</div>
</div>
<script src="https://d3e54v103j8qbb.cloudfront.net/js/jquery-3.5.1.min.dc5e7f18c8.js?site=64559587fb856f82933854bf" type="text/javascript" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://assets-global.website-files.com/64559587fb856f82933854bf/js/webflow.edd529858.js" type="text/javascript"></script>
<script src="https://meet.bench.co/js/forms2/js/forms2.min.js"></script>

 

You always need to load the Forms 2.0 library before using MktoForms2. (This is something your dev should’ve figured out instantly IMO, and no, it couldn’t work this way on another site.)

View solution in original post

8 REPLIES 8
Michael_Florin
Level 10

Re: update forms2 script URL?

No, script looks correct to me. There must be something else in play here. I assume the Form ID exists and URLs and Munchkin are examples, right?

RaulEr
Level 4

Re: update forms2 script URL?

Yes, the URLs are just for the example. In fact, our forms work perfectly right now on our current website. 

 

However, we are testing a new website (different provider), and the migration person is telling me that the Mkto form is not loading. So when I go to the console I see the "Uncaught ReferenceError: MktoForms2 is not defined" and I think is because it's using

//pages.example.com

instead of

https://pages.example.com

 

SanfordWhiteman
Level 10 - Community Moderator

Re: update forms2 script URL?


@RaulEr wrote:

Yes, the URLs are just for the example. In fact, our forms work perfectly right now on our current website. 

 

However, we are testing a new website (different provider), and the migration person is telling me that the Mkto form is not loading. So when I go to the console I see the "Uncaught ReferenceError: MktoForms2 is not defined" and I think is because it's using

//pages.example.com

instead of

https://pages.example.com

There’s no reason to guess here. The reason will be explicit in the browser console.

 

If the page is insecure (http:) then // is the same as http://.

 

If the page is secure (https:) then // is the same as https://.

 

In 2023, all pages should be secure. Which leads to the conclusion that you don’t have https://pages.example.com  set up correctly. You can’t add that cert by yourself, Marketo support needs to do it.

 

 

SanfordWhiteman
Level 10 - Community Moderator

Re: update forms2 script URL?

Protocol-relative URLs (which are expected here, this isn’t new!) use the protocol of the main document.

 

If the main doc uses https: but the pages.example.com domain doesn’t have the right SSL cert set up by Marketo support, you’ll get a certificate error. This is easy to see in your browser console, by the way.

 

Open a case to have the SSL cert added to your LP domain.

RaulEr
Level 4

Re: update forms2 script URL?

If the script is ok and the new site has the munchkin code running, what else must be updated to make it work just as the current site does? Does the new site need to update CNAMEs or something like that? I'm not familiar with that so I'm not sure.

SanfordWhiteman
Level 10 - Community Moderator

Re: update forms2 script URL?


If the script is ok and the new site has the munchkin code running, what else must be updated to make it work just as the current site does? Does the new site need to update CNAMEs or something like that? I'm not familiar with that so I'm not sure.

Marketo forms don’t depend on Munchkin. (Munchkin complements forms but it’s not a requirement.)

 

You’re not being specific enough about the form embed: can you please include the real URL here so we can test?

RaulEr
Level 4

Re: update forms2 script URL?

This is the URL of the test webpage: https://benchco.webflow.io/marketo-test-form

SanfordWhiteman
Level 10 - Community Moderator

Re: update forms2 script URL?

You’re simply loading the scripts in the wrong order:

<div class="marketo_form-embed w-embed w-script">
<form id="mktoForm_1574"></form>
<script>MktoForms2.loadForm("//meet.bench.co", "729-JTY-427", 1574);</script></div>
</div>
</div>
<script src="https://d3e54v103j8qbb.cloudfront.net/js/jquery-3.5.1.min.dc5e7f18c8.js?site=64559587fb856f82933854bf" type="text/javascript" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://assets-global.website-files.com/64559587fb856f82933854bf/js/webflow.edd529858.js" type="text/javascript"></script>
<script src="https://meet.bench.co/js/forms2/js/forms2.min.js"></script>

 

You always need to load the Forms 2.0 library before using MktoForms2. (This is something your dev should’ve figured out instantly IMO, and no, it couldn’t work this way on another site.)