Hi,
I have JavaScript on my form to disable a two-option field, based on the value of a lookup. Without putting the entire function here, basically I'm using:
formContext.getControl(approvalToggle).setDisabled(true);
This function runs both on load and on change of the lookup fields. My script sets the default to disabled if the lookup is empty. When a specific value is used in the lookup, then the two-option field becomes enabled.
This works just fine. The problem is that if I use the Toggle control on the field, the field can be enabled with the right lookup value, but the control itself remains disabled.
For example:
In the first row, the Toggle control isn't being used and the lookup has the right value to unlock the field. Everything is working fine. In the third row, the lookup is empty, the field is locked, also everything working fine. But in the second row, the lookup has the right value to unlock the field (you can see the lock icon disappears) but the Toggle control remains inoperable. If I save, then refresh the browser (chrome or edge, same issue) then the Toggle control becomes active.
So I guess controls on fields have to be referenced separately? Does anyone know how to do this?