... and translating the single Checkboxes field to multiple Checkbox fields (mapped to Booleans in Marketo) is done using this code:
If you have a Checkboxes group you want to turn into multiple underlying fields, you need to mark up the <label> element like so:
Other than that the Checkboxes field is set up like any other one:
Note: you do need a single Marketo field backing the Checkboxes field (Firm Status in the example above). It can be a disposable/temporary field, as it's only important for managing the look-and-feel of the form.
Then, on submission (right before the form is posted) the code finds all the Stored Values that are checked and for each one, adds a hidden field with the value "yes" (as Booleans expect). Unchecked fields turn into hidden fields set to "no."
So if Firm Status has "Fuchsia" and "Gold Checked" on submission, then new fields are created: Fuchsia="yes", Gold="yes", "Turquoise"="no".
So you get the best of both worlds: the Checkboxes field type, and the underlying Booleans.
This code is separate from the Select All code, though they complement each other well.
Ok makes sense. I didn't know there was a checkbox set field! That opens up a whole new world of possibilities.
So we're trying to set up our preference center now that we have a bigger team and can put out different types of content on a more regular basis. Our salesforce admin has created a field for each option as a boolean field and all of our email sends will have the corresponding smart lists to segment the data base.
Would it be best to update the fields to a checkbox set field instead, that way we can get the functionality of clearing all preferences if the unsubscribe all box is ticked? Or is there a better way to set up our preference center to manage the existing multiple fields and smart lists?
Our salesforce admin has created a field for each option as a boolean field and all of our email sends will have the corresponding smart lists to segment the data base.
A reasonable way to set up the database schema. But it's more manageable on the form side to use a Checkboxes set with a form-only field ("form-only" means "exists in your database, but only so it can be used in Form Editor, not in Smart Lists").
Then you use the JS I linked to above to translate the form-only field into each of the constituent Booleans.
Ok @SanfordWhiteman last question!!
I've got the fields in a checkbox set and mapping correctly AND the unselect all function is working correctly!
We have the unselect all field as the unsubscribe from all options (which is why we wanted it to unselect all the other fields in the form) however, with the -* to unselect all in the stored value, we can't mark the boolean field unsubscribe all to true. Is there a way the field can do both actions when selected? The first being to clear the other values and the second to map the the boolean field as true?
I suppose the workaround would be having a smart campaign that says when the form is completed and all other fields are marked false - set the unsubscribe all to true?
We have the unselect all field as the unsubscribe from all options (which is why we wanted it to unselect all the other fields in the form) however, with the -* to unselect all in the stored value, we can't mark the boolean field unsubscribe all to true. Is there a way the field can do both actions when selected?
I updated the code (both components) to treat any string that follows -*- or *- (note the additional hyphen) as the Boolean field.
So if the field value is -*-MyOtherField then MyOtherField will be the Boolean set to yes or no.
I have a similar opportunity. Marketo Expert Services helped us with a new Preference Center Form. Each option is set up as Checkboxes, Label is 'blank', Values are populated with <h4>xxxxx</h4> code to bold the selection.
How/where do I place the "-*-" code you referred to so that when a person selects the "Unsubscribed" field, it will 'uncheck' all the other fields?