Conditional form field based on known/unknown visitor? | Community
Skip to main content
May 9, 2018
Question

Conditional form field based on known/unknown visitor?

  • May 9, 2018
  • 1 reply
  • 1738 views

Hello - is it possible to only display certain fields on a form if the visitor is already known to us? Or vice versa, only display a field if they are not known?

If this is possible, how can it be done? Would this only work on Marketo landing pages? Or could it work for Marketo forms embedded in our website too?

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

1 reply

SanfordWhiteman
Level 10
May 10, 2018

Hello - is it possible to only display certain fields on a form if the visitor is already known to us? Or vice versa, only display a field if they are not known?

It is possible by using JS to pre-check the known visitor endpoint, but let me suggest a different method that simply reuses the built-in Known Visitor HTML ("If Known Visitor, show Custom HTML") feature.

Set up 2 forms, Form A for anonymous sessions (= unknown visitors) and Form K for associated sessions (= known visitors).

Include the scaffolding for both forms (<form id="mktoForm_nnn">) in the page.

Enable KV HTML on Form A. In the Custom HTML Editor, have a <script> that loads Form K.

This way, when KV HTML is triggered, it loads the other form instead.