anyone know where to access the body tags in forms? | Community
Skip to main content
April 2, 2015
Question

anyone know where to access the body tags in forms?

  • April 2, 2015
  • 11 replies
  • 3063 views
need to add custom code to code in the body tag of forms
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

11 replies

Justin_Cooperm2
Level 10
April 2, 2015
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?
April 2, 2015
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
April 2, 2015
@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()).
 
April 2, 2015
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
April 2, 2015
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.
April 2, 2015
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
April 2, 2015
is it possible to add code to the form via the "embed code" feature? on the form's main page
Justin_Cooperm2
Level 10
April 2, 2015
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
April 2, 2015
@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....
March 23, 2016

Hey Regie,

I am having the exact same issue with where to put that code! Did you ever seem to figure it out?

Thanks,

AnnaBelle

Justin_Cooperm2
Level 10
March 23, 2016

LinkedIn is discontinuing Lead Accelerator, so this won't be useful anymore.

April 8, 2016

Even though they are discontinuing LLA, it would still be useful for anyone who has a LinkedIn profile. We have paid media ads on LinkedIn, so I would love to figure out where to put that code.

AnnaBelle