I need to make a field required if another field is empty, and Iâm doing it with âoperatorsâ, as described here, using the following code, but the field empty does not âtriggerâ the required correctly. Can you tell me how to detect if a field is empty?
$dictionary['Account']['fields']['fiscal_code_c'] = array(
'name' => 'fiscal_code_c',
'vname' => 'LBL_FISCAL_CODE',
'type' => 'varchar',
'len' => 16,
'default' => ' ',
'comment' => 'Codice Fiscale',
'merge_filter' => 'enabled',
'logic' => [
'required' => [
'key' => 'required',
'modes' => ['edit', 'create'],
'params' => [
'fieldDependencies' => [
'vat_number_c'
],
'activeOnFields' => [
'vat_number_c' => [
['operator' => 'is-empty']
],
],
],
]
],
);
My problem is that the operator [âoperatorâ => âis-emptyâ] doesnât trigger the empty field. Any suggestion?