Skip to main content
December 22, 2014
Question

Form - At Least One Field Must be Checked to Submit Form

  • December 22, 2014
  • 6 replies
  • 1484 views
My form has 3 email preference fields and an unsubscribe link. None of the fields are required, but I want to create a rule (or custom code / javascript) that says at least one field needs to be checked to submit the form. If they do not check any fields an error message would appear saying "At least one email preference needs to be selected."
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

6 replies

Adam_Vavrek1
Level 8
December 22, 2014
Could you create a custom field with three choices and make that field required? You could then create triggers to change other fields based on what the leads select.
December 22, 2014
Bethany, best way to do this is using custom Javascript as you mentioned.

You could modify the following for your purposes:

http://www.willmaster.com/library/manage-forms/user-friendly-form-field-required.php
Dory_Viscoglio
Level 10
December 22, 2014
If the three email preference options are unique of each other and someone wouldn't potentially want both A and B, then Adam's idea should work. Otherwise, you will want to do custom JS as you suggested and Charlie has linked to above. 
December 22, 2014
I think Javascript will probably be the best option. I am very new to Marketo - How can I add the onsubmit attribute and id to the form tag if I build my form within Marketo? It doesn't seem like I have access to edit this.
December 22, 2014
Bethany,

To do JS, you'll need to copy your form code into a landing page HTML box.
December 29, 2014
For the form code, I see both a script and noscript code. I would assume I need to copy over the script code only? This form is currently set to dynamically populate based on the user's preferences, will this still work correctly if I copy the form code directly to the page? Here is a link to the current page using a form built in Marketo: http://preferences.discoveryco.com/manage