install4j:可配置的表单从下拉列表更改可见性
install4j: Configurable form change visibility from drop-down list
我有一个可配置表单,我想根据下拉列表的值更改另一个字段的可见性。
例如,我有一个包含条目 A,B
的下拉列表,它的变量名称是 testDD
.
我有一个文本字段 smtpMailServer
,我只想在 testDD
的值为 A
时显示它。
我在 smtpMailServer
的可见性中尝试了以下方法但没有成功:
return ((String) context.getVariable("testDD")).equals("A");
return (context.getVariable("testDD")).equals("A");
而且我还尝试使用以下代码将脚本添加到 testDD
更改选择脚本
context.setVariable("ThisFormConfiguration", selectedItem);
并使用上面的代码 ThisFormConfiguration
而不是 testDD
。但是没用。
你能帮帮我吗?
谢谢!
I have tried the following approaches in smtpMailServer's visibility without success
表单组件的可见性脚本仅在显示表单时进行评估。你应该保留它,但它只处理初始条件。
and I've also tried to add a script to testDD Change Selection Script with
The following code context.setVariable("ThisFormConfiguration", selectedItem); A
使用"Selection change script"属性是正确的想法,但是你的脚本没有效果。没有从变量到表单组件的实时绑定,在显示表单时读取变量,并在用户单击 "Next" 时更新变量。
您必须使用以下选择脚本:
formEnvironment.getFormComponentById("123").setVisible(selectedItem.equals("A"));
其中“123”必须替换为文本字段的 ID。
我有一个可配置表单,我想根据下拉列表的值更改另一个字段的可见性。
例如,我有一个包含条目 A,B
的下拉列表,它的变量名称是 testDD
.
我有一个文本字段 smtpMailServer
,我只想在 testDD
的值为 A
时显示它。
我在 smtpMailServer
的可见性中尝试了以下方法但没有成功:
return ((String) context.getVariable("testDD")).equals("A");
return (context.getVariable("testDD")).equals("A");
而且我还尝试使用以下代码将脚本添加到 testDD
更改选择脚本
context.setVariable("ThisFormConfiguration", selectedItem);
并使用上面的代码 ThisFormConfiguration
而不是 testDD
。但是没用。
你能帮帮我吗?
谢谢!
I have tried the following approaches in smtpMailServer's visibility without success
表单组件的可见性脚本仅在显示表单时进行评估。你应该保留它,但它只处理初始条件。
and I've also tried to add a script to testDD Change Selection Script with The following code context.setVariable("ThisFormConfiguration", selectedItem); A
使用"Selection change script"属性是正确的想法,但是你的脚本没有效果。没有从变量到表单组件的实时绑定,在显示表单时读取变量,并在用户单击 "Next" 时更新变量。
您必须使用以下选择脚本:
formEnvironment.getFormComponentById("123").setVisible(selectedItem.equals("A"));
其中“123”必须替换为文本字段的 ID。