I have a form with a checkboxes section where a person can select up to 8 selections of 28 possible selections, and I want to 1. Limit the amount of selections the person can make, and 2. have those selections show up in an alert email that comes to me when the form is submitted.
I've tested the form and the only value that comes in through the token for the multiple selections is a "1."
Any ideas on how I can make both of these options work?
Hi Alec,
Limiting the number of checked boxes will require some JS.
If you are using 1 field with "checkboxes" field type, you can edit the stored values.
If you are using multiple fields, each with a "checkbox" (single) field type, you cannot. But, if theses fields are not boolean ones, but string ones, you could change them to "checkboxes" field type (keeping multiple fields) and you would be able to choose the stored value. Remember the stored value is the one that renders in your alert email.
-Greg
In these cases, you can either run some JS to populate a "Yes" value to a String field, or use a data flow to do the same thing. Usually, if I plan in advance, I make these fields read as Yes/No/Blank.
If you want to display 1=Yes=TRUE on a page, this is much easier because JS will let you recode the text.
Hi Josh,
We're running into the same problem as above: we want to show which selections were chosen and it shows up as a "1". I showed my web director this email chain and that you said the edit could be made in JS, but he was wondering where/how?
Can you elaborate please?
No, you can't change the value of a Boolean {{lead.token}} in JavaScript. That is not possible, because a true Boolean will always be output as a "1" or "" (the empty string) by default. You can change the output style using a Velocity (Email Script) token, however. If you search the Community you'll see how.
The other option is to not use a true Boolean but a string, in which case it can natively hold any value you want ("yes" or "true" etc.). However, this removes the advantages of data validation and simplicity that you get with Booleans.
Hi Greg,
Thanks, your solution worked great. Does anyone have any examples JS that they've used that would put a limit on the number of selections that can be made in this situation?
Thanks,
Alec
Search the Community. I posted a solution for "Checkboxes Max Checked" in the past month or so.
Here is the post: Re: Forms - selecting a limited number of options
here is Sanford's code: http://codepen.io/figureone/pen/xVLWgR?editors=001
-Greg
Hi Sanford,
I have used your Velocity (Email Script) for boolean fields, which worked perfectly! (Thank you!) But I was hoping you had another suggestion for a web form with boolean fields. I want to make sure that the email alert I send based on the form being filled out only sends the fields that are checked at the time of the form fill, not historical requests.
Example:
In testing out my form initially, I selected checkbox "a" and hit submit. Email alert shows that I selected checkbox "a."
In the second form fill-out, I selected checkbox "b" and hit submit. Email alert shows I have selected both checkbox "a" and checkbox "b."
Any insight would be helpful!
Alec:
The way Marketo processes data, a “1” is the equivalent to a Yes checkmark.
Mike Turner
Senior Manager, Lead-to-Revenue Marketing
Textron Aviation
316.517.1015 PHONE
316.665.0378 MOBILE