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

Anonymous
Not applicable

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

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
Adam_Vavrek1
Level 9 - Champion Alumni

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

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.
Anonymous
Not applicable

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

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

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

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

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

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.
Anonymous
Not applicable

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

Bethany,

To do JS, you'll need to copy your form code into a landing page HTML box.
Anonymous
Not applicable

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

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