In the Text Editor, pick JavaScript as the Script Type and the JavaScript Code.
The following JavaScript code is displayed.
function HidingField(executionContext)
{
var formContext=executionContext.getFormContext();
let Required = formContext.getAttribute(“sun_field2”).getValue();
if(Required== true)
{
formContext.getControl(“sun_field3”).setVisible(true);
}
else {
formContext.getControl(“sun_field3”).setVisible(false);
}
}