SOLVED

Hiding a form field if the visitor is known and a member

Go to solution
Vidhi
Level 2

Hiding a form field if the visitor is known and a member

Hi Everyone,

I am trying to find the solution to adding the KVHTML code on Forms 2.0 to hide or fade the field if the First Name and Email Address field is auto-populated for the members. Below highlighted is the field with two options i.e. Yes or No which we would like to hide if First Name and email are auto-populated. It is a captcha-enabled form.  

Vidhi_0-1684992243505.png

Is there any other way to fade/hide this field.?

 

Kind Regards,

Vidhi

 

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Hiding a form field if the visitor is known and a member

  • Create a new String field that you add to the form as Hidden. It can be a reusable field, so call it something generic like Form Visibility Manager 01.
  • Configure a VR so the Member field shows only if Form Visibility Manager 01 is not empty.
  • In a whenReady listener (which fires after pre-fill) check if First Name and Email Address are both filled. If either one is empty, set Form Visibility Manager 01 (using setValues()) to a meaningful value like “yes”. This will trigger the VR to show the Member field.

View solution in original post

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: Hiding a form field if the visitor is known and a member

Not sure why you’re referring to KV HTML. KV HTML is a complete replacement for the visible form if the person is known.

 

You can enable Visibility Rules for Are you a member? to only show that field if First Name or Email Address has been pre-filled.

 

You can’t have Visibility Rules that show a field based on 2 other fields simultaneously (i.e. First Name and Email Address). For that you’d need JavaScript.

 

Also, “member” has a specific meaning within Marketo (program member) but you’re just talking about a Boolean field. Always good to be as clear as possible about your business terminology so it doesn’t overlap with Marketo terms.

Vidhi
Level 2

Re: Hiding a form field if the visitor is known and a member

Hi @SanfordWhiteman 

Thank you for your input. Appreciate it!

Sorry for mixing up the Marketo terms. When I mentioned member then I meant that the record is already in our database.

  • Also, I was trying out a solution to replace the form with a new form & only two field values with custom HTML if a visitor is known but I was confused with the concept of KVHTML. Thank you for highlighting its use case.
  • I tried using the Visibility rules on the field 'Are you a member' using the 'If condition' in the editor. But it did not help as I added Show Field If Email is empty and as soon as the value got filled in the Email field, the field disappeared. I guess it is my mistake as it is not how it works.
  • I think adding a JS code would solve my problem on the Marketo-hosted Landing Page.

Kind Regards,

Vidhi

 

 

 

Tags (1)
SanfordWhiteman
Level 10 - Community Moderator

Re: Hiding a form field if the visitor is known and a member

  • Create a new String field that you add to the form as Hidden. It can be a reusable field, so call it something generic like Form Visibility Manager 01.
  • Configure a VR so the Member field shows only if Form Visibility Manager 01 is not empty.
  • In a whenReady listener (which fires after pre-fill) check if First Name and Email Address are both filled. If either one is empty, set Form Visibility Manager 01 (using setValues()) to a meaningful value like “yes”. This will trigger the VR to show the Member field.
Vidhi
Level 2

Re: Hiding a form field if the visitor is known and a member

Hi @SanfordWhiteman ,

Extremely Sorry, I could not reply due to the many many things including the Marketo outage that kept me occupied.

However, I built the solution like you had recommended and tested it 🙂

Works like a charm!

Thank you!

Vidhi