Hi experts!
I have a multi-select field (X) that I wan't to hide / show, require / not require based on an other fields (Y) value.
If field Y = 1 then show and require field X
If field Y = 0 then hide field X and set required to none
This is what I have achieved so far (and made sure works):
function setFieldrequirementasrequired(executionContext)
{
var formContext = executionContext.getFormContext();
var Y = formContext.getAttribute("column_Y").getValue();
if (Y == 1)
{
formContext.getAttribute("column_X").setRequiredLevel("required");
}
else
{
formContext.getAttribute("column_X").setRequiredLevel("none");
}
}
function showFieldOnChange(executionContext)
{
formContext = executionContext.getFormContext();
if (formContext.getAttribute("column_Y").getValue() == 0)
{
formContext.getControl("column_X").setVisible(false);
}
else
{
formContext.getControl("column_X").setVisible(true);
}
}
But, I'm struggeling with my last requirement: when field Y changes from 1 to 0 I wan't to deselect selected values in field X.
Any suggestions?