如何根据两种情况使 Kentico 表单中的字段可见性起作用

How to make field visibility in Kentico forms work based on two conditions

我正在尝试根据两个条件显示在线表单中的字段可见性。 我有一个包含 4 个项目的复选框,如果字段一或字段一和字段二是 selected,我希望显示下一个字段。

右边的依赖字段框都打勾了。

我试过以下方法:

aquatic_type.Value == "25m pool" || aquatic_type.Value == ("50m pool","25m pool")

aquatic_type.Value == "25m pool" || aquatic_type.Value == ("50m pool" && "25m pool")

如果我只有 select 25m 池,它就会工作,但如果我 select 25m 和 50m,该字段将根本不会显示。

有人可以向我提供 OR 工作原理的结构和两个标准吗?

您的宏应该如下所示:

aquatic_type.Value == "25m pool" || aquatic_type.Value == "50m pool"

Kentico K# 宏语法在本质上与 C# 非常相似

此外,由于您的字段可以同时包含“25m 池”和“50m 池”,您可以尝试检查任一值,如下所示:

aquatic_type.Value.Contains("25m pool") || aquatic_type.Value.Contains("50m pool")