1 Reply Latest reply on May 9, 2018 10:11 PM by Sanford Whiteman

    Conditional form field based on known/unknown visitor?

    Carly Stevens

      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?

        • Re: Conditional form field based on known/unknown visitor?
          Sanford Whiteman

          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.