No Code Attached Yet bug
avatar skurvish
skurvish
18 Jul 2022

Steps to reproduce the issue

Have a field on the menu form that itself has a subfield with a fieldlist.

Expected result

Form renders correctly.

Actual result

Form renders a fixed text field and does not render any other fields on that tab.

System information (as much as possible)

Current Joomla with very little on it.

Additional comments

I am attempting to convert an existing component from J3 to J4. The component adds menu items and has a default.xml file in the view to define additional menu parameters. These worked just fine in J3. The xml file defines a number of additional tabs that are rendered on the menu edit screen. On one tab I have a field which has fields under it and one of these fields has a fieldset. When the menu system renders this tab it chokes and simply displays a textbox. I am attaching a screen image of the menu edit output so you can see what I mean.

Below is a stripped down version of the xml markup that illustrates the problem.

    <fields name="params">
        <fieldset name="request">

            <field name="listid"
                   type="tables"
                   label="LIST_LABEL"
                   description="LIST_DESC"
            />

        </fieldset>

        <fieldset name="basic" label="LIST_OPTIONS">
<!-- other fields in here -->
            <field name="list_elements"
                   type="modalrepeat"
                   label="LIST_ELEMENTS_LABEL"
                   description="LIST_ELEMENTS_DESC"
            >
                <fields name="params">
                    <fieldset modal="true" name="list_elements_modal" repeat="true">
                        <field name="show_in_list"
                               type="listfields"
                               size="30"
                               multiple="true"
                               label="ELEMENTS_HEADING"
                        />
                    </fieldset>
                </fields>
            </field>
        </fieldset>

    </fields>

I have identified where the problem is occurring and a modification I made to the code which solves it for me. I do not know what other impact this might have so I am hopeful the experts can weigh in.

The problem file is layouts/joomla/edit/params.php at line 113 where it determines if the field has children.
Existing code:

$hasChildren  = $xml->xpath('//fieldset[@name="' . $name . '"]//fieldset[not(ancestor::field/form/*)]');

My code change that is working for me:

$hasChildren  = $xml->xpath('//fieldset[@name="' . $name . '"]//fieldset[not(ancestor::field/form/*)]//fieldset[not(ancestor::field/fields/*)]');

As I am working on a component that is not of my original design it is very possible the xml markup is wrong and if so I would be happy to hear what it should look like.

Otherwise I await your feedback.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar skurvish skurvish - open - 18 Jul 2022
avatar skurvish skurvish - change - 18 Jul 2022
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 18 Jul 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 18 Jul 2022
avatar richard67
richard67 - comment - 20 Jul 2022

Why do you wrap the 3rd, inner fieldset into a <fields name="params"> in your xml? Maybe that’s the problem?

avatar skurvish
skurvish - comment - 21 Jul 2022

I inherited this component so don't know the history of why, but removing the fields doesn't solve the problem. I get the same result. But thanks for the suggestion.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38294.

avatar skurvish
skurvish - comment - 25 Jul 2022

Anyone?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38294.

avatar Hackwar Hackwar - change - 22 Feb 2023
Labels Added: bug
avatar Hackwar Hackwar - labeled - 22 Feb 2023

Add a Comment

Login with GitHub to post a comment