Embed Code Forms 2.0 - Can't edit script block

Anonymous
Not applicable

Embed Code Forms 2.0 - Can't edit script block

I'm trying to edit the embed code for a 2.0 form (as per Forms 2.0 » Marketo Developers ), but I am unable to edit the script block. (Marketing Activities, right-click on the form and choose 'Embed Code')

What I'm trying to achieve is for a form to appear as a lightbox popup used on a marketo landing page. This is obviously easy to achieve on my own website as I can simply grab the lightbox form code. However, when I want to use the form on a Marketo landing page I only have the option of inserting the form, i.e can't select for it to be a popup/lightbox. See my result in attached screengrab.

Again, the developer Marketo documentation I was referred to suggests to edit the embed form code to achieve the lightbox look, only this doesn't seem to work as explained in the documentation.

Any advice?

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Embed Code Forms 2.0 - Can't edit script block

When the docs talk about "editing the script block" they don't literally mean editing the textarea under Embed Code. That textarea is read-only for copying-and-pasting (and editing) in your website.

When using a form in a Marketo LP, you use the MktoForms2.whenReady event (as opposed to the onReady event, which is only available for embeds, the whenReady can actually be used in both cases).

<SCRIPT>

MktoForms2.whenReady(function(form){

     MktoForms2.lightbox(form).show();

});

</SCRIPT>

This script would go inside an HTML block that you also drag into your page along with the form.

Alok_Ramsisaria
Level 10

Re: Embed Code Forms 2.0 - Can't edit script block

Hi Jannica, There is a very simple method of using lightbox pop-up form. After you've created your form, just click on the 'Form Actions' tab above, and select the 'embed code' option from the drop down. From there, select 'Code Type' - 'Lightbox'. From there you will get your code to be used in your landing page.

For e.g, consider this lightbox code:

"

<script src="https://app-aba.marketo.com/js/forms2/js/forms2.min.js" type="text/javascript"></script>

<form></form>

<script type="text/javascript">// <![CDATA[

MktoForms2.loadForm("//app-aba.marketo.com", "100-AEK-913", 2612, function (form){MktoForms2.lightbox(form).show();});

// ]]></script>

"

Now you just have to put this code anywhere in your landing page.

Now for editing the script, you have to start from here:
MktoForms2.loadForm("//app-aba.marketo.com", "100-AEK-913", 2612, function (form){
  MktoForms2.lightbox(form).show();
  //your function here...
});

Why this is a simpler method is because, you wouldn't have to drag a form into your landing page every time you create a new landing page. Just use this code either in your template of your landing page or edit draft of the landing page.

SanfordWhiteman
Level 10 - Community Moderator

Re: Embed Code Forms 2.0 - Can't edit script block

I would not advise using the embed code in a Marketo-hosted LP as you will use functionality.  You should instead keep the LP's form awareness (form widget/placeholder).