Form on known lead HTML | Community
Skip to main content
Nicholas_Manojl
Level 8
May 31, 2016
Question

Form on known lead HTML

  • May 31, 2016
  • 2 replies
  • 2917 views

I have an embedded form.

I would like to use both the known lead custom HTML ("Welcome back {{lead.FirstName}}").

I would also like to include an additional enquiry form..

Can I somehow include an HTML form element that writes to {{lead.enquiry message}}?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

SanfordWhiteman
Level 10
May 31, 2016

Sure, you can trigger the embedding of an alternate form using JS in the KL HTML.  Just do it the usual way with MktoForms2.loadForm(). This uses more resources than would be ideal (downloading two form descriptors and rendering two forms in total) but it'll work.

Alternately, you could add a new <textarea> within the KL HTML (I'm assuming enquiry message is a textarea) and append its value to the form in an onSubmit listener. (Remember, the form is still submitted when the lead clicks the {{form.Button}}, and you can still listen to form events as usual.)  But this is a bit far afield and I don't like adding form elements unless there's truly no backing field (in this case, you have the corresponding field in your Marketo database.)

Nicholas_Manojl
Level 8
May 31, 2016

I seem to be having trouble getting JS into the KL custom HTML.

SanfordWhiteman
Level 10
May 31, 2016

You can't put the 2nd <form> inside the 1st one!  You can trigger the embedding of the other form, but one can't literally nest inside the other. You can have the forms as DOM siblings.

Nicholas_Manojl
Level 8
June 1, 2016

Weird.. yesterday my HTML editor was basic with no rich formatting capability.

Nicholas_Manojl
Level 8
June 1, 2016

However.. I found that pasting the embed code did indeed work...