The custom field get's stored.
Error Message „COM_FIELDS_FIELD_INVALID_DEFAULT_VALUE” caused by method checkDefaultValue in FieldsModelField of com_fields.
Joomla! 3.9.2
FieldsModelField::checkDefaultValue runs into line 275 (as it is supposed to do)...:
$result = $rule->test(simplexml_import_dom($node->firstChild), $data['default_value']);
... and \Joomla\CMS\Form\Rule\OptionsRule->test() expects that \SimpleXMLElement $element has some options where the default value can (or not) be found in, in line 89:
return in_array((string) $value, $options);
But \SimpleXMLElement $element has no options (the result of the SQL Query). Thus it will allways fail.
Status | New | ⇒ | Information Required |
@HLeithner gently Reminder.
Category | ⇒ | com_fields |
Labels |
Added:
J3 Issue
|
Title |
|
The reason is the same like in field itemlist. It extends FieldsListPlugin
.
https://github.com/joomla/joomla-cms/blob/staging/plugins/fields/sql/sql.php#L19
Thus the validation runs through OptionsRule.php
while saving without options. ==> always false
See #24643 . I've opened it just because the original issue #15173 is > 2 years old or so without any clarifying statements.
But before we start to write several prs like that and maybe open new security issues it would be nice if someone of the "com_fields experts" would issue a statement if that's the correct solution or if we need new BlablaRules.php or whatever.
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-04-30 07:15:18 |
Closed_By | ⇒ | franz-wohlkoenig |
@HLeithner can you please comment?