简体   繁体   中英

install4j: Configurable form change visibility from drop-down list

I have a Configurable Form and i want to change the visibility of another field based on the value of a Drop-down list.

For example I have a Drop-Down list with entries A,B and the variable name for it is testDD .

I have a Text field smtpMailServer that I want to display only if testDD 's value is A .

I have tried the following approaches in smtpMailServer 's visibility without success:

return ((String) context.getVariable("testDD")).equals("A");

return (context.getVariable("testDD")).equals("A");

and I've also tried to add a script to testDD Change Selection Script with The following code

context.setVariable("ThisFormConfiguration", selectedItem); And use the code above with ThisFormConfiguration instead of testDD . But it's not working.

Could you please help me?

Thanks!

I have tried the following approaches in smtpMailServer's visibility without success

The visibility script of a form component is only evaluated when the form is shown. You should keep it, but it only handles the initial condition.

and I've also tried to add a script to testDD Change Selection Script with The following code context.setVariable("ThisFormConfiguration", selectedItem); A

Using the "Selection change script" property is the right idea, but your script has no effect. There is no live binding from the variables to the form components, the variable is read when the form is shown and updated when the user clicks "Next".

You have to use the following selection script:

formEnvironment.getFormComponentById("123").setVisible(selectedItem.equals("A"));

where "123" has to be replaced by the ID of the text field.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM