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

Anonymous
Not applicable
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."
Tags (1)
6 REPLIES 6
Anonymous
Not applicable
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
Anonymous
Not applicable
Bethany,

To do JS, you'll need to copy your form code into a landing page HTML box.
Anonymous
Not applicable
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.
Dory_Viscoglio
Level 10
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. 
Anonymous
Not applicable
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
Adam_Vavrek1
Level 9 - Champion Alumni
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.