Reputation: 155
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!
Upvotes: 1
Views: 396
Reputation: 48015
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.
Upvotes: 2