Form field conditional on current vlaue

Dan_Stevens_
Level 10 - Champion Alumni

Re: Form field conditional on current vlaue

Hi Greg - the js that Sanford provided is to just keep the "other" field in sync with the opt-in field.  It's not a replacement for the process I've illustrated here.  And like I mentioned above, this process only works (using functionality within the UI) with Marketo LPs, not forms embedded on our website.  It would be interesting to see the full js code to accomplish this with embedded forms (hiding the field if the field is not empty; or if opt-in date exists) - vs. having to use a smart campaign to keep the values persistent.

Grégoire_Miche2
Level 10

Re: Form field conditional on current vlaue

Hi Dan,

There are 2 issues, in fact.

  • Keeping the fields sync'ed, whether the field is your "Avanade Opt-in Date", the "Unsubscribe" field or any other field. For this, Sanford's JS is, IMHO, the best technique
  • Being able to prefill the hidden field that serves as a controller for the opt-in field visibility even on embedded forms outside of Marketo LP's, as you point out. This is a "Non Marketo LP prefill issue" and the best person to answer this Sanford Whiteman

-Greg

SanfordWhiteman
Level 10 - Community Moderator

Re: Form field conditional on current vlaue

A full-fledged embedded PreFill solution will certainly fix this.

But also consider one quirk about Marketo checkbox fields: if a checkbox is in your Progressive Profiling section, it will always be shown until it is checked. ProgPro logic does not support "intentionally left blank" fields; they are considered the same as unfilled fields.

So if you're willing to have that checkbox be counted in your ProgPro max fields (or if you're not otherwise using ProgPro at all) this is another way to conditionally show a field w/this particular datatype.

Amber_Hobson
Level 8 - Champion Alumni

Re: Form field conditional on current vlaue

So, I love the discussions! But I want to make sure that I'm reading this correctly since for my purposes, this may fix everything. Since this is a progressive form (embedded on our site), the field will show up no matter what as long as it remains unchecked? We don't have any other checkbox type fields on our progressive forms, so I didn't know that was how those work. That may make my life a lot easier since it will always appear at the top. I understand that cookies and other items can cause it to reappear later, but for those that have filled out a lot of our forms, that field won't show up once they have checked it the first time? And until they check it, it will always show up?

SanfordWhiteman
Level 10 - Community Moderator

Re: Form field conditional on current vlaue

the field will show up no matter what as long as it remains unchecked?

Correct. Outside of the Progressive Profiling block, checkbox fields (in Marketo-land forms, not on standard HTML forms) can have the 2 values "yes" or "no." But in the ProgPro block, "no" is considered empty. So as long as the Boolean field remains false on the server, that field will always be shown on the form.

Dylan_Rodgers
Level 2

Re: Form field conditional on current vlaue

Amber Hobson‌ and Sanford,

I applied Progressive Profiling to our opt-in checkbox so once someone opts in (checks the box), they won't see the checkbox anymore and that has worked as expected. Thanks for the insight.

I have run into one snag though—I was testing to see if after opting in (checking the checkbox) and then unsubscribing the checkbox would reappear. That did not happen, which makes sense because the checkbox value and the unsubscribe are different. So here's my question:

In your opinion, which is the better option:

  1. Creating a Smart Campaign that will listen for unsubscribes and update the value in the checkbox (I'm not sure if this would even force the checkbox to show up again or not, but I think it might)
  2. Using javascript to display the checkbox if the prospect has not opted in and hide it if they have.

I appreciate any help you can provide in thinking through this.

SanfordWhiteman
Level 10 - Community Moderator

Re: Form field conditional on current vlaue

Given the expected order of operations, a Smart Campaign sounds fine.

Grégoire_Miche2
Level 10

Re: Form field conditional on current vlaue

I like this idea of using the Opt-in date as a controller for the opt-in field visibility, BTW. If you sync the Unsubscribe field with the Opt-in one, you can also use the Unsubscribe field as a controller.

-Greg

Anonymous
Not applicable

Re: Form field conditional on current vlaue

Hi Dan,

If I am reading this correctly... you overwrite the opt in program with latest program even though the checkbox value was hidden (opt in date exist)? Wouldn't you want to have the original opt in program tracked even though someone fills out multiple forms, or am I missing something?

Dan_Stevens_
Level 10 - Champion Alumni

Re: Form field conditional on current vlaue

Yulia - if a value exists, we do not overwrite this (we block field updates).  We also have another field called "Last Opt-in program", which does get updated if future opt-in consent is given.