The following code works for me. I have department field in contacts module and the department becomes visible and required when I set the title as ‘Manager’.
We need to have to logic types ‘required’ and ‘displayType’ as shown in the example.
Could you please try the code for your fields and see it helps.
1 =>
array(
'name' => 'department',
'label' => 'LBL_DEPARTMENT',
'display' => 'none',
'logic' => [
'hide-show-dept' => [
'key' => 'displayType',
'modes' => ['create','edit'],
'params' => [
'fieldDependencies' => ['title'],
'targetDisplayType' => 'show',
'activeOnFields' => [
'title' => ['Manager'],
],
],
],
'dept-required' => [
'key' => 'required',
'modes' => ['create','edit'],
'params' => [
'fieldDependencies' => ['title'],
'activeOnFields' => [
'title' => ['Manager'],
],
],
],
],
),
Run php bin/console cache:clear
and realod the application to test.