Following various posts here I am trying to conditionally Show/Hide some panels on a record view using dependencies.
I have tried the following but clearly have a problem as it is not working.
IF someone can point out the error of my ways I would really appreciate it.
The panels are in a custom module with the system name of "sior_Referrals"
Their visibility should be set by a drop down field called "ref_type" in that module with the values "In" or "Out".
If it is "In"
LBL_RECORDVIEW_PANEL1 should be Visible
LBL_RECORDVIEW_PANEL2 should be Hidden
If it is "Out"
LBL_RECORDVIEW_PANEL2 should be Visible
LBL_RECORDVIEW_PANEL1 should be Hidden
I am putting the following code in a file here:
\custom\modules\sior_Referrals\Ext\Dependencies\deps.ext.php
<?php
$dependencies['sior_Referrals']['ref_type'] = array(
'hooks' => array("edit","view"),
'trigger' => 'true',
'triggerFields' => array('ref_type'),
'formula' => 'equal($ref_type, "In")',
'onload' => true,
'actions' => array(
array( 'name' => 'SetPanelVisibility',
'params' => array( 'target' => 'LBL_RECORDVIEW_PANEL1',
'value' => true,
),
),
array( 'name' => 'SetPanelVisibility',
'params' => array( 'target' => 'LBL_RECORDVIEW_PANEL2',
'value' => false,
),
),
),
);
$dependencies['sior_Referrals']['ref_type'] = array(
'hooks' => array("edit","view"),
'trigger' => 'true',
'triggerFields' => array('ref_type'),
'formula' => 'equal($ref_type, "Out")',
'onload' => true,
'actions' => array(
array( 'name' => 'SetPanelVisibility',
'params' => array( 'target' => 'LBL_RECORDVIEW_PANEL2',
'value' => true,
),
),
array( 'name' => 'SetPanelVisibility',
'params' => array( 'target' => 'LBL_RECORDVIEW_PANEL1',
'value' => false,
),
),
),
);