Hi everybody. I need to create a form where people can sign up for training events and select up to 16 different events/days/times at a time. Upon form submission, Marketo should send an email alert to the internal team listing the options selected.
I can create 16 checkbox (boolean) fields and 16 string fields. The string fields will contain the day/time information that corresponds to each T/F checkbox. If checkbox 1 = TRUE, then I change the data value in the corresponding string field 1 so I can use that text in the email alert, etc.
I'll recycle these fields as the dates pass and new dates are added to the schedule.
In the email alert body, there will be gaps because not all dates will be selected.
Is there a more scalable and elegant solution to this that's still easy to implement?
This is what it looks like in the email setup:
and here is this text in the actual email when option 1 and 3 are selected; the white space is due to option 2 not having been selected in the form:
Another problem is that there is too much space between the lines in the form (whether or not I use a fieldset or place these fields separately without a set). Where there are 16 of them, it'll be really long and ugly. Maybe it's possible to make this list look more compact in CSS:
Any advice would be appreciated.
Solved! Go to Solution.
That setup with Booleans and Strings is almost certainly not the way Iād do it.
But if you must do it that way, you can use a Velocity token to output only the non-empty fields.
#set( $fields = [
"Field_Apple",
"Field_Orange",
"Field_Pear",
"Field_Banana"
] )
#foreach( $field in $fields )
#if( !$lead[$field].isEmpty() )
${lead[$field]}<br>
#end
#end
Yes, you only need a single Textarea field and then 16 different checkboxes on the form (using the Checkboxes type in Form Editor).
Each box corresponds to a separate sub-value. All sub-values are automatically concatenated by Marketo, with a semicolon as the delimiter.
Weāre talking about the single delimited string, right? You can split it on the semicolon, then re-join it with an HTML <br>
.
#set( $subValues = $lead.value.split("\s*;\s*") )
#set( $subValuesWithBreaks = $display.list($subValues,"<br>") )
${subValuesWithBreaks}
That setup with Booleans and Strings is almost certainly not the way Iād do it.
But if you must do it that way, you can use a Velocity token to output only the non-empty fields.
#set( $fields = [
"Field_Apple",
"Field_Orange",
"Field_Pear",
"Field_Banana"
] )
#foreach( $field in $fields )
#if( !$lead[$field].isEmpty() )
${lead[$field]}<br>
#end
#end
Thank you, Sanford! Is there a better approach than 32 checkbox + string fields?
Yes, you only need a single Textarea field and then 16 different checkboxes on the form (using the Checkboxes type in Form Editor).
Each box corresponds to a separate sub-value. All sub-values are automatically concatenated by Marketo, with a semicolon as the delimiter.
Thank you, Sanford! Is there any way to separate the entries with a break rather than a ';', to make it more readable in the email? I tried <br> between the entries and it did not work. It's not a big deal since I am using it in an internal alert but still would be great to make it more user-friendly. Thank you!
Weāre talking about the single delimited string, right? You can split it on the semicolon, then re-join it with an HTML <br>
.
#set( $subValues = $lead.value.split("\s*;\s*") )
#set( $subValuesWithBreaks = $display.list($subValues,"<br>") )
${subValuesWithBreaks}
Thank you, Sanford!