Re: anyone know where to access the body tags in forms?

Anonymous
Not applicable

anyone know where to access the body tags in forms?

need to add custom code to code in the body tag of forms
Tags (1)
15 REPLIES 15
Justin_Cooperm2
Level 10

Re: anyone know where to access the body tags in forms?

Forms don't have a <body> tag. A body tag defines the document's body. A form is one component within a document (webpage). Forms have other HTML elements. What specifically are you trying to do?
Anonymous
Not applicable

Re: anyone know where to access the body tags in forms?

I'm trying to add a linkedin in auto-fill form code. so marketo has a linekdin option, but it takes about 2-3 steps to complete. I am trying to eliminate that step and add custom scripting code to be placed in the <body>
SanfordWhiteman
Level 10 - Community Moderator

Re: anyone know where to access the body tags in forms?

@Regie K Please post a link to the LI code you're referring to.

Like @Justin C says HTML forms (Marketo forms are HTML <FORM> tags under the hood) never have <BODY> tags.  However the Forms 2.0 API is very flexible and almost certainly will let you execute your code in the form's initial callback (the 4th parameter to MktoForms2.loadForm()).
 
Anonymous
Not applicable

Re: anyone know where to access the body tags in forms?

AH awesome. And thanks for the reply.

The following is my code, just need to know where to put it in:
 
<script src="//platform.linkedin.com/in.js" type="text/javascript">
  api_key: 757smum0z4yd79
  noAuth: true
  lang: en_US
</script>
<script type="IN/Form" data-form="Request Demo LinkedIn NEW" data-field-firstname="First Name" data-field-lastname="Last Name" data-field-phone="Phone Number" data-field-email="Company Email" data-field-company="Company"></script>
<script src="//platform.linkedin.com/in.js" type="text/javascript">
  api_key: 757smum0z4yd79
  noAuth: true
  lang: en_US
</script>



Thanks again
SanfordWhiteman
Level 10 - Community Moderator

Re: anyone know where to access the body tags in forms?

I can tell you that this code duplicates what you provided using the Forms 2.0 API (injects the LinkedIn script dynamically after the Marketo form is loaded and refers to the Marketo fields).  Past that, I can't tell you much: documentation on the LI autofill feature is really scant.  You'd probably want to talk to the LI community next.
Anonymous
Not applicable

Re: anyone know where to access the body tags in forms?

But where in the marketo form code would I put this in? I can't imagine putting it within the css styles or anything


I don't mind testing it out myself
Anonymous
Not applicable

Re: anyone know where to access the body tags in forms?

is it possible to add code to the form via the "embed code" feature? on the form's main page
Justin_Cooperm2
Level 10

Re: anyone know where to access the body tags in forms?

Regie,

You would get the data you need from the LinkedIn API (like Sanford I don't know much about this, you should look into their documentation) and then update the form via JavaScript. Are you familiar with how to do this?

var textbox = document.getElementById("myTextBox");
textbox.value = "Something";

Instead of "something" you would fill that field with the value you retrieved from LinkedIn.
 
SanfordWhiteman
Level 10 - Community Moderator

Re: anyone know where to access the body tags in forms?

@Regie what I posted is a customized version of the Marketo embed code.

@Justin I think the LinkedIn code is supposed to fill the fields automatically (?) based on the mapping element (LI field = Mkto field) when it loads.  But this is a really terribly documented feature for a major platform. I hope it's still in beta....