Created
January 31, 2018 09:30
-
-
Save elchele/2fcc453f5a3cd8c9a56bdae558a29e84 to your computer and use it in GitHub Desktop.
Custom dependency to set a field as required based on another field's value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* This example sets the Status Description field to required | |
if the Status field is set to 'Dead' within Leads module. | |
File: ./custom/Extension/modules/Leads/Ext/Dependencies/set_required.ext.php */ | |
$dependencies['Leads']['req_status_desc_dep'] = array( | |
'hooks' => array("edit"), | |
'trigger' => 'true', | |
'triggerFields' => array('status'), | |
'onload' => true, | |
'actions' => array( | |
array( | |
'name' => 'SetRequired', | |
'params' => array( | |
'target' => 'status_description', | |
'label' => 'LBL_STATUS_DESCRIPTION', | |
'value' => 'equal($status, "Dead")' | |
) | |
), | |
), | |
//Actions fire if the trigger is false. Optional. | |
'notActions' => array(), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment