Re: Is it possible to pre-tick a box on a form using a token?

Paul_Raybould
Level 2

Is it possible to pre-tick a box on a form using a token?

Hi.

I've created a form on a follow-up landing page that enables people to specify their topics of interest through checkboxes.

As 'Form Pre-fill is enabled  assumedit would autopopulate these checkboxes with the information we already have on the person but it doesn't.

Is there a way to define whether a checkbox should be preticked based on existing data? maybe using tokens?

Thanks,

Paul

11 REPLIES 11
Chris_Wilcox
Level 9

Re: Is it possible to pre-tick a box on a form using a token?

Hi Paul,

Is this a Marketo hosted page, or are you using a form embed?

If this is a Marketo hosted page, there are options on the field settings for the form to make it act as you would prefer. Prefill will look at the existing values in the database for that individual and check or uncheck the boxes as their record indicates. If you'd prefer to pre-check boxes for people, you can use the "initially checked" option to do so (screenshots below for reference)

If this is to be done on an external page with an embedded Marketo form, it's a little more complicated. Sanford Whiteman‌ has a great article on his blog about a (mostly) simple way to enable form prefill on external websites that you can reference to understand how to make that happen. 

Hope this helps!

Chris

2019-07-01_13-20-46.jpg

SanfordWhiteman
Level 10 - Community Moderator

Re: Is it possible to pre-tick a box on a form using a token?

If by "a follow-up landing page" you mean the page that loads directly after a form fillout, a.k.a. Thank You page -- that is indeed the usual meaning, I just want to be sure -- then you have a problem that can't be solved by my Pre-Fill solution alone. (Though of course I appreciate Chris's shoutout, and highly recommend it for anyone who needs to restore/add Pre-Fill functionality.)

The reason you have an extended problem is that right after somebody fills out a form, the very next page, or even the next 2-3 pageviews, is not guaranteed to reflect existing values from their lead record -- regardless of what Pre-Fill method you use, native or my special method.

This is because their Munchkin cookie is associated in the background and is not guaranteed to be in sync with their browser navigation! It could take as little as 50ms, or as much as 5 seconds or more in pathological cases, but however long it takes, you can't expect it to be complete when your Thank You page loads (sometimes it is, sometimes it isn't). 

So to correct for this situation, you can poll the upcoming page in the forms onSuccess method before redirecting the page, i.e. you check every 200ms or so to see if the next page will contain the lead's data, and as soon as it does, let the redirect continue.  This is not a common need, but for a case like yours it is necessary.  It's not something I've officially put down on the blog but we have it in prod on various sites.

Paul_Raybould
Level 2

Re: Is it possible to pre-tick a box on a form using a token?

Thank you Chris Wilcox‌ and Sanford Whiteman‌ for you feedback. i actually managed to solve the issue using the following https://nation.marketo.com/thread/50485-pre-fill-workaround 

SanfordWhiteman
Level 10 - Community Moderator

Re: Is it possible to pre-tick a box on a form using a token?

So were you *not* talking about the follow-up page that loads directly after a form fillout?

Paul_Raybould
Level 2

Re: Is it possible to pre-tick a box on a form using a token?

Hi Sanford. yes I was referring to a follow up page after a form fill. Basically the follow up page is asking them to choose topics of interest. If they're a new lead the boxes would be blank, but if they've chosen topics of interest before it shows those as ticked.

Thanks,

Paul

SanfordWhiteman
Level 10 - Community Moderator

Re: Is it possible to pre-tick a box on a form using a token?

It's not actually working then, for the reason noted above. It only appears to be working because you haven't tested enough variations (you have to simulate suboptimal conditions). 

The page immediately following a form fillout is not guaranteed to be associated with the lead that filled out the form. So using tokens on that page does not give consistent results across user and server experiences. Sorry to disappoint, but you need something more.

Paul_Raybould
Level 2

Re: Is it possible to pre-tick a box on a form using a token?

Damn.

Have you instructions for the following then?

"So to correct for this situation, you can poll the upcoming page in the forms onSuccess method before redirecting the page, i.e. you check every 200ms or so to see if the next page will contain the lead's data, and as soon as it does, let the redirect continue.  This is not a common need, but for a case like yours it is necessary.  It's not something I've officially put down on the blog but we have it in prod on various sites."

Thanks,

Paul

SanfordWhiteman
Level 10 - Community Moderator

Re: Is it possible to pre-tick a box on a form using a token?

I'll have to write it up on the blog. It'll be copy-and-pastable for you, but the explanation's too long to be put in this thread.

Plus, it's past 4am for me.   

Expect it to be up on Monday.

Paul_Raybould
Level 2

Re: Is it possible to pre-tick a box on a form using a token?

Thanks sanford. have a good weekend.

Paul