-
DCA table field
In table with structure like this
$GLOBALS['TL_DCA']['']['fields'][''] = array(
'label' =>
'exclude' => true,
'inputType' => 'checkbox',
'options_callback' => array(),
'eval' => array(
mandatory => true;,
),
'save_callback' => array(),
),
'sql' => '',
);
How can i change 'mandatory' field if some cases are fulfilled. Like if this is 1 mandatory is true or 0 then is false?
Is possible to make some function to manage fields?
Thanks
-
You have to format your code to see your errors:
PHP Code:
$GLOBALS['TL_DCA']['']['fields'][''] = array(
'label' =>
'exclude' => true,
'inputType' => 'checkbox',
'options_callback' => array(),
'eval' => array(
mandatory => true;,
),
'save_callback' => array(),
),
'sql' => '',
);
Corrected:
PHP Code:
$GLOBALS['TL_DCA']['TABLENAME']['fields']['FIELDNAME'] = array(
'label' => '',
'exclude' => true,
'inputType' => 'checkbox',
'options_callback' => array(),
'eval' => array(
'mandatory' => true
),
'save_callback' => array(),
'sql' => ''
);
To just change the mandatory setting you have to use this:
PHP Code:
$GLOBALS['TL_DCA']['TABLENAME']['fields']['FIELDNAME']['eval']['mandatory'] = true;
-
Thanks
I deleted fields properties because of privacy. Thanks, your help saved my day. :)