Forms - Using Conditional Logic to mark a field "Is Required" | Community
Skip to main content
Jason_Reber__TH
Level 2
April 18, 2016
Question

Forms - Using Conditional Logic to mark a field "Is Required"

  • April 18, 2016
  • 2 replies
  • 3490 views

Hi all,

I have a form in Marketo with inputs for the user to provide their name, address, phone number, etc. I also have a "Send marketing brochure" checkbox on that form.

If this is the first time the user is submitting the form, the "Send marketing brochure" checkbox should be required.

If the user has submitted the form before (aka, if they have already been sent the marketing brochure), then the "Send marketing brochure" checkbox should be optional.

What is the best way to accomplish this?

Thanks for any help or leads (pun intended) you can provide,

Jason

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

2 replies

Grégoire_Miche2
Level 10
April 18, 2016

Hi Jason,

  • You cannot make a checkbox required, because it has only 2 status : True or False, and in the case of a checkbox, empty/null = false.
  • If you want to make the field required, you will have to make it a picklist (You can set no default or False as a default)
  • There is no way to know whether the lead is filling out the form for the first or second time. But you can set the field to pre-fill, if the form is used on a Marketo landing page. If it's a picklist field, just let it required, deactivate the prefill and set it to false as a default value.

-Greg

SanfordWhiteman
Level 10
April 18, 2016

You cannot make a checkbox required, because it has only 2 status : True or False, and in the case of a checkbox, empty/null = false.

Well, you can make it required, but the outcome may not be what Jason wants.  That is, you can require it to be checked, but you can't require it to be acted upon, because there is no third choice for the user beyond checking it or refraining from checking it. As you point out, to have a tri-state field, you need something more complex like radio buttons or a select, where it is possible to both interact with the widget and set it to false.

For detecting a previously submitted form in the same browser, you can do this with an embedded form just as well.  It doesn't require a Marketo LP.  It isn't clear from Jason's description whether he expects this to work across devices (a browser being equivalent to a device for session purposes).

Grégoire_Miche2
Level 10
April 19, 2016

HI Sanford,

My assumption was that about detecting a form has been filled out across 2 sessions. But you are right, may be that was within a single session...

-Greg

Jason_Reber__TH
Level 2
April 20, 2016

Hi Greg, Sanford, thanks for your replies.

I was wanting to detect if a user had filled out the form previously, even in a different session. Is that possible out-of-the box?

I was thinking I could add a new custom field called "Has submitted Jasons form" and set the value to true on submit of the form. Then have our developer make some code changes:

The form is a two-page form, with the first page asking only for the user's email address, so before the second page is shown (with the other fields and the fields we want to require) the web code could make a call to Marketo via API to get that field's value for that individual and adjust which fields are required or not on page two.

Grégoire_Miche2
Level 10
April 20, 2016

It will take some JS coding, but I would rather use a form that's hidden at first, then when it is loaded, you would be able to look into the values and if this one is false, keep the form hidden, otherwise, change the display:none style and rerender it.

Have your developer to give a look at Forms 2.0 » Marketo Developers

-Greg