Hello everyone.
I want to use multiple choice to show, or not, matching content.
When it's not multiple, no worries, but there, in this case, impossible to make it work.
Thank you for your help
Hello all : {formmenu: apple; banana; cherry; name=choices; multiple=yes}.
{if: choices = "apple"; trim=right}show apple.{endif: trim=left}
{if: choices = "banana"; trim=right}show banana.{endif: trim=left}
{if: choices = "banana"; trim=right}show cherry.{endif: trim=left}
Hi @Frenchy_Devs
Good news, this is possible!
When you have a menu that accepts multiple selections, the selections get saved as a list, which is formatted like this: ["first selection", "second selection", "third selection"] etc...
As a result, you can't do {if: choices="first selection"} but rather need to use the includes() function.
Your snippet would look like:
Hello all : {formmenu: apple; banana; cherry; name=choices; multiple=yes}.
{if: includes(choices, "apple"); trim=right}show apple.{endif: trim=left}
{if: includes(choices, "banana"); trim=right}show banana.{endif: trim=left}
{if: includes(choices, "cherry"); trim=right}show cherry.{endif: trim=left}
1 Like
.... i say again... impossible to find alone this solution 
Big big big thanks for your help @Andrew_Hall and fantastic community !
I use the "contains" formula to accomplish this. What's the difference with the "contains" and "includes" formulas?
Hi Jennifer, the "contains" function is used to check if a string contains a specific substring. For example, if we have the string "apple is good"
, we can use the "contains" function to check if it contains the substring "apple". On the other hand, the "includes" function is used to check if a list includes a specific element. For instance, if we have a list ["apple", "orange"]
, we can use the "includes" function to check if it includes the element "apple".
Thank you for the clarification. I see the difference and the benefits of each function. This is very good to know.
1 Like