I am not well versed in Javascript but I am trying to hide/show two different drop down (Choise) fields based on the value of another Choice field. Since I can't use Business Rule on a multi choice field I am stuck with Javascript.
Error message: Cannot read properties of null (reading 'setVisible')
My code
________________________________________________________________________________________________________
function HideFields(executionContext)
{
var formContext = executionContext.getFormContext();
var typeOfServiceProviderValue = formContext.getAttribute("vantage_typeofserviceprovider").getValue();
if (typeOfServiceProviderValue == 218700000)
{
formContext.getControl("vantage_typeofsupportiveservicesneeded").setVisible(true);
}
else
{
formContext.getControl("vantage_typeofsupportiveservicesneeded").setVisible(false);
}
var businesstype = formContext.getAttribute("businesstypecode").getValue();
if (businesstype == 809600001) //Service Provider
{
formContext.getControl("vantage_CountiesServed").setVisible(true);
}
else
{
formContext.getControl("vantage_CountiesServed").setVisible(false);
}
}