SOLVED

Open Lightbox form on initial form submit based on field value

Go to solution
Anonymous
Not applicable

Open Lightbox form on initial form submit based on field value

I have a MKTO form embeded on our site, and I would like to have a second MKTO form appear in the lightbox when the first form is submitted, but only appear based on if a specific value was selected in the initial embed form.  Does anyone know if this is possible?  I'm leaning towards Sanford Whiteman​ πŸ˜‰

Thanks,

Mike

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Open Lightbox form on initial form submit based on field value

http://codepen.io/figureone/pen/mEEjgY/

In this example, we check for the last name "gonext" on the first form and if it matches, we popup the second form.

It's actually designed for an unlimited sequence of forms.  I posted another approach to the same thing about a year ago, maybe more.

View solution in original post

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Open Lightbox form on initial form submit based on field value

http://codepen.io/figureone/pen/mEEjgY/

In this example, we check for the last name "gonext" on the first form and if it matches, we popup the second form.

It's actually designed for an unlimited sequence of forms.  I posted another approach to the same thing about a year ago, maybe more.

Anonymous
Not applicable

Re: Open Lightbox form on initial form submit based on field value

As always - you pull through for me.  Thank you!

Anonymous
Not applicable

Re: Open Lightbox form on initial form submit based on field value

Sanford - 2 additional concerns:

1: How would this work if the second form in the lightbox was to appear based on two values?  Your example uses last name, but if the field was a drop-down and I had values 1, 2, 3.  How would it work to have the lightboxed form appear if 1 or 2 were selected in the drop-down of the first form?

2: Once the lightbox form is submitted, how do you get the thank you message to appear on the parent page?

Thanks,

Mike

SanfordWhiteman
Level 10 - Community Moderator

Re: Open Lightbox form on initial form submit based on field value

  1. Just more JS conditions: if ( [ '1', '2'].indexOf(vals.fieldName) != -1 ) ... etc.
  2. In the final onSuccess (the one where I commented, "Do your final redirect") you can add a CSS class to reveal a previously hidden DIV in the main document, or related approaches (dynamically create the container, relocate the container from a hidden parent to a visible parent, dynamically populate container text/innerHTML, et al.).
Anonymous
Not applicable

Re: Open Lightbox form on initial form submit based on field value

I thought so too, but I can get the lightbox form to appear, but no TY message on the parent page.

SanfordWhiteman
Level 10 - Community Moderator

Re: Open Lightbox form on initial form submit based on field value

Works for me -- in the final onSuccess, for example, I added a simple call to insertAdjacentHTML.