NPM Resource Changed PR-6.2-dev Pending

User tests: Successful: Unsuccessful:

avatar TLWebdesign
TLWebdesign
11 Oct 2026

When a row is added to a subform, the fields of the rows that a nested subform already has (its minimum or default rows) kept the X placeholder of the row template in their names and ids. The values of those rows were submitted under the placeholder key, so they were lost or ended up in another row on save.

Pull Request resolves #48606.

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

When a row is added to a subform that contains a nested subform, the nested subform's own existing rows (its min rows or default rows) are not renamed. Their fields keep the X placeholder of the row template in their names, ids and labels, for example jform[params][items][itemsX][children][children0][child].

On save, the values of those nested rows are submitted under the placeholder key itemsX instead of the key of their row. With more than one new row they overwrite each other, the data ends up in the wrong row or is lost, and an extra empty row appears after reload. The ids are duplicated across rows as well.

Each subform instance fixes only its own fields. fixUniqueAttributes() of the outer subform skips the fields inside a nested subform and only renames the nested joomla-field-subform element. The name setter of the nested subform updated its row template, but not the rows it already has.

The name setter now also renames the fields of the existing rows (fixNamePrefix()). Only the prefix of the name, id, for and aria-describedby attributes is replaced. The nested subform's own row index is in a later part of the name and is not affected. A nested subform further down is renamed the same way and its own setter fixes its rows, so deeper nesting works recursively.

Two smaller changes in the same area:

  • The template update in the setter handles the name, id, for and aria-describedby attributes in the same way as the rows, instead of only name=". Without that, rows added later from a nested template kept stale ids from the third level down, and name based ids like the -rules element of the password field and an aria-describedby with several ids were missed. The id is derived from the name like FormField::getId() does, so a subform name with a hyphen works too.
  • fixUniqueAttributes() looks up the label by the id derived from the name when the element has no id. The joomla-field-subform element has no id, so the label of a nested subform field in a new row was never renamed.

Testing Instructions

The PR changes JavaScript. Use the prebuilt package of this PR, or apply it and run npm ci.

Core has no form with a nested subform, so add one temporarily. Open modules/mod_custom/mod_custom.xml and add this field inside <fields name="params"> / <fieldset name="options">:

<field name="items" type="subform" label="Items" multiple="true">
	<form>
		<field name="name" type="text" label="Name" />
		<field name="flag" type="checkbox" label="Flag" value="1" />
		<field name="kind" type="radio" label="Kind" default="a" class="btn-group">
			<option value="a">A</option>
			<option value="b">B</option>
		</field>
		<field name="children" type="subform" label="Children" multiple="true" min="1" layout="joomla.form.field.subform.repeatable-table">
			<form>
				<field name="child" type="text" label="Child" />
				<field name="color" type="list" label="Color" default="red">
					<option value="red">Red</option>
					<option value="green">Green</option>
					<option value="blue">Blue</option>
				</field>
				<field name="tags" type="checkboxes" label="Tags">
					<option value="x">X</option>
					<option value="y">Y</option>
					<option value="z">Z</option>
				</field>
				<field name="active" type="checkbox" label="Active" value="1" />
				<field name="size" type="radio" label="Size" default="s" class="btn-group">
					<option value="s">S</option>
					<option value="l">L</option>
				</field>
			</form>
		</field>
	</form>
</field>
  1. Content → Site Modules → New → Custom.
  2. Enter a title and open the Options tab. In the "Items" subform click the green + button twice to add two rows.
  3. In the first row fill in "Outer 1", tick "Flag" and choose "B". In its nested row fill in "Child 1", choose "Green", tick "Y" and "Z", tick "Active" and choose "L".
  4. In the second row fill in "Outer 2". In its nested row fill in "Child 2", choose "Blue" and tick "X".
  5. In the second row click the + in the header of the "Children" table to add a second nested row and fill in "Child 2b", choose "Green", tick "X" and "Z", tick "Active" and choose "L".
  6. Save.

Click the labels of the checkboxes and radio buttons rather than the inputs, so the for attributes are tested too.

Remove the field from mod_custom.xml again when done.

Actual result BEFORE applying this Pull Request

After saving, three rows are shown: "Outer 1" with an empty nested row, an empty row with the nested rows "Child 2" and "Child 2b", and "Outer 2" with an empty nested row. "Child 1" and its options are lost.

Before saving, clicking a label in a nested row of the second outer row ticks the input in the first outer row, because the ids are the same in both rows. In the browser inspector the inputs of the nested rows have names containing [itemsX].

Expected result AFTER applying this Pull Request

After saving, the two rows are shown with their own values: "Outer 1" / "Child 1" and "Outer 2" / "Child 2", "Child 2b", with the options as entered.

The inputs of the nested rows have the name of their row, [items0] and [items1], and unique ids. The labels toggle the input of their own row.

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar TLWebdesign TLWebdesign - open - 11 Oct 2026
avatar TLWebdesign TLWebdesign - change - 11 Oct 2026
Status New ⇒ Pending
avatar joomla-cms-bot joomla-cms-bot - change - 11 Oct 2026
Category ⇒ JavaScript NPM Change
avatar brianteeman
brianteeman - comment - 11 Oct 2026

This might have been fixed with my pr #48599

avatar TLWebdesign TLWebdesign - change - 11 Oct 2026
The description was changed
avatar TLWebdesign TLWebdesign - edited - 11 Oct 2026
avatar TLWebdesign
TLWebdesign - comment - 11 Oct 2026

This might have been fixed with my pr #48599

Hi,

ahh yeah it touches almost the same code i see But my fix does touch a different problem than what you're fixing tho.

avatar tecpromotion tecpromotion - test_item - 11 Oct 2026 - Tested successfully
avatar tecpromotion
tecpromotion - comment - 11 Oct 2026

I have tested this item ✅ successfully on 851593b


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

avatar tecpromotion
tecpromotion - comment - 11 Oct 2026

I have tested this item ✅ successfully on 851593b


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

avatar Fedik
Fedik - comment - 11 Oct 2026

I am sorry, the fix is incorrect.

Each Subform instance should fix only their own fields, or we will get much fancier bugs.

avatar brianteeman
brianteeman - comment - 11 Oct 2026

Previously, the code filtered out fields belonging to nested subforms. Removing that filtering means the outer subform's fixUniqueAttributes() can rewrite names and IDs throughout the nested subtree, even though those nested rows have their own indexing and naming rules.

avatar tecpromotion
tecpromotion - comment - 12 Oct 2026

A tip, following @Fedik's point: the nested subform can do this itself in its name setter. The setter already renames the row template when the outer row is added; the rows that already exist in the nested subform (min / default rows) are the only thing it leaves out.

avatar TLWebdesign
TLWebdesign - comment - 12 Oct 2026

yes thats how i am rewriting it. thanks stefan and Fedik for your feedback.

avatar TLWebdesign TLWebdesign - change - 12 Oct 2026
The description was changed
Labels Added: NPM Resource Changed PR-6.2-dev
avatar TLWebdesign TLWebdesign - edited - 12 Oct 2026
avatar TLWebdesign TLWebdesign - change - 12 Oct 2026
The description was changed
avatar TLWebdesign TLWebdesign - edited - 12 Oct 2026
avatar TLWebdesign
TLWebdesign - comment - 12 Oct 2026

Thanks @Fedik, you are right. I reworked it: the "Filter out nested" block is back unchanged, and the outer subform only renames the nested joomla-field-subform element, as before. The name setter of the nested subform now fixes the fields of its own existing rows, in addition to its row template. Deeper levels are reached the same way through their own setter, so each instance only touches its own fields. The description is updated with the details.
@tecpromotion the code changed since your test, could you test again?

avatar Fedik
Fedik - comment - 13 Oct 2026

Looks okay.
Would be good to have extensive test. For subform with few more fields, checkboxes, radio and select elements.

avatar Fedik
Fedik - comment - 13 Oct 2026

Looks okay.
Would be good to have extensive test. For subform with few more fields, checkboxes, radio and select elements.

avatar TLWebdesign TLWebdesign - change - 15 Oct 2026
The description was changed
avatar TLWebdesign TLWebdesign - edited - 15 Oct 2026
avatar TLWebdesign
TLWebdesign - comment - 15 Oct 2026

Thanks @Fedik. I tested with a wider form: the outer rows with text, checkbox and radio fields, the nested rows with text, list, checkboxes, checkbox and radio fields, two new outer rows and an extra nested row added in the second one, and all options set by clicking their labels. Names, ids and labels are correct before saving and all values are saved in the right rows. The testing instructions now use that form, so testers cover these field types too.

Add a Comment

Login with GitHub to post a comment