If a form has multiple editor fields with the same name but within different groups, all XTD button actions are applied in first editor only.
I.e. in item has top-level field <field name="description" type="editor"...
+ a field with the same name
but inside the another group like <fields name="params"> <field name="description" type="editor"...
If you click any XTD buttons in the editor field of params
group, all actions are actually applied in the first field.
I.e. Readmore is inserted in the first field etc.
Test:
Edit admin article.xml form of com_content and add these code after <fieldset name="basic" ...
line:
<field
name="articletext"
type="editor"
label="COM_CONTENT_FIELD_ARTICLETEXT_LABEL"
description="COM_CONTENT_FIELD_ARTICLETEXT_DESC"
filter="JComponentHelper::filterText"
buttons="true"
/>
Now we have two fields with the name articletext
, the first one is original article text in Content tab, the second one is displayed in Options tab and has the field group attribs
, these are two different fields even with the same name
attribute.
Try to use any buttons in this second field, see that actually all actions are applied in the main editor field displayed in Content tab.
Button actions should be executed separately for each editor instance.
Button actions are executed on first field only.
Both Joomla 3 and 4 are affected.
Labels |
Added:
No Code Attached Yet
|
No, it's possible in JForm if the fields have different groups.
The issue is with the TinyMCE plugin code which doesn't use the field ID but only last part of field name to identify the editor instance:
$id = preg_replace('/(\s|[^A-Za-z0-9_])+/', '_', $id);
$nameGroup = explode('[', preg_replace('/\[\]|\]/', '', $name));
$fieldName = end($nameGroup);
``
No, it's possible in JForm if the fields have different groups.
The issue is with the TinyMCE plugin code which doesn't use the field ID but only last part of field name to identify the editor instance:
$id = preg_replace('/(\s|[^A-Za-z0-9_])+/', '_', $id); $nameGroup = explode('[', preg_replace('/\[\]|\]/', '', $name)); $fieldName = end($nameGroup);
As weird as it is to want to do, it is perfectly valid HTML to run fields with names like "fieldset[fieldName]" and "fieldset2[fieldName]".
Should $fieldName
be modified to prepend it's fieldset's name?
Labels |
Added:
bug
|
You CANNOT have 2 fields with the same name