Is it possible to pre-tick a box on a form using a token? | Community
Skip to main content
Paul_Raybould
Level 2
July 1, 2019
Question

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

  • July 1, 2019
  • 3 replies
  • 6310 views

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

3 replies

Chris_Wilcox
Level 8
July 1, 2019

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

SanfordWhiteman
Level 10
July 1, 2019

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
July 2, 2019

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

SanfordWhiteman
Level 10
July 2, 2019

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

Paul_Raybould
Level 2
July 3, 2019

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