No Code Attached Yet
avatar JoomBall
JoomBall
21 Sep 2022

Steps to reproduce the issue

To reproduce the problem you have to edit a menu item, when modifying the main menu it performs an ajax correctly to modify options in the parent item. The problem is that it doesn't update via choices.

In form administrator\components\com_menus\forms\item.xml:
<field name="parent_id" type="MenuParent" label="COM_MENUS_ITEM_FIELD_PARENT_LABEL" layout="joomla.form.field.list-fancy-select" default="1" filter="int" clientid="0" > <option value="1">JGLOBAL_ROOT_PARENT</option> </field>

You have to modify the file media\com_menus\js\admin-item-edit.js

PARENTID

Expected result

Return the corresponding menu items.

Actual result

The selector does not update the options in Choices.

System information (as much as possible)

PHP Version 8.1.2
Joomla 4.2.2

Additional comments

I need to update selectors with Choices and haven't found any examples. With Chosen it was quite simple.

I have tried:

activeXHR = Joomla.request({ url, onSuccess: response => { activeXHR = null; const items = response ? JSON.parse(response) : [];
const ele = new Choices(document.getElementById('element')); if (items.length) { ele.setChoices(items, 'value', 'text', false); } }, onError: () => { activeXHR = null; } });

But it doesn't work for me and I don't think I have to re-instantiate it with: new Choices()

The instance is already created in file media\system\js\fields\joomla-field-fancy-select.js, so I don't know how to get an instance of a selector already created.

Can you help me please, thank you.

avatar JoomBall JoomBall - open - 21 Sep 2022
avatar joomla-cms-bot joomla-cms-bot - change - 21 Sep 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 21 Sep 2022
avatar JoomBall JoomBall - change - 21 Sep 2022
The description was changed
avatar JoomBall JoomBall - edited - 21 Sep 2022
avatar JoomBall
JoomBall - comment - 7 Jan 2023

Hi @wilsonge , @brianteeman

I have reported a joomla bug for quite some time and there is not even a response.
I understand that there is a lot to answer but the errors should be corrected as soon as possible for the correct functioning of joomla.
Thank you.

avatar SniperSister
SniperSister - comment - 17 Jan 2023

See #39659

avatar richard67
richard67 - comment - 17 Jan 2023

Closing as having a pull request. Please test #39659 . Thanks in advance.

avatar richard67 richard67 - change - 17 Jan 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-01-17 21:35:35
Closed_By richard67
avatar richard67 richard67 - close - 17 Jan 2023

Add a Comment

Login with GitHub to post a comment