Skip to content

Conversation

@Fedik
Copy link
Member

@Fedik Fedik commented Sep 13, 2025

Pull Request for Issue #45994 .

Summary of Changes

Add subform-order-changed event when order is changed in subform.

Testing Instructions

Apply patch.
Run npm install.
Add subform somewhere, example in Custom HTML module parameters:

<field type="subform" name="subform" label="Subform" multiple="true">
  <form>
    <field type="text" name="text" label="Text"/>
  </form>
</field>

Add in to index.php of Atum template:

$wa->addInlineScript('
 document.addEventListener("subform-order-changed", function(event) {
    console.log("fromPosition: " + event.detail.fromPosition, "toPosition: " + event.detail.toPosition);
 });
', [], ['type' => 'module']);

Open the form with sbform, open browser console.
Try sort the rows in subform, and check console output.

Actual result BEFORE applying this Pull Request

Console is silent

Expected result AFTER applying this Pull Request

In console a message like "fromPosition: 0, toPosition: 1"

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:
  • No documentation changes for docs.joomla.org needed
  • Pull Request link for manual.joomla.org: Subform JavaScript events Manual#579
  • No documentation changes for manual.joomla.org needed

@joomla-cms-bot joomla-cms-bot added NPM Resource Changed This Pull Request can't be tested by Patchtester PR-6.0-dev labels Sep 13, 2025
@Fedik
Copy link
Member Author

Fedik commented Sep 13, 2025

I will rebase to 6.1 when it will be in sync

@ceford
Copy link
Contributor

ceford commented Sep 17, 2025

I have tested this item ✅ successfully on 08a3f52

I found the instructions difficult. As this is a single JavaScript file change the rebuild should be npm run build:js. I used a new instance of Modules: Articles to test as there are already two subforms there. I created two instances of the Test text and moved them up/down. In the Console I needed to select the Logs item to see the message (I am not too familiar with the Console). Got there in the end!


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

@Fedik Fedik changed the title [6.0] Subform: add order-changed event [6.1] Subform: add order-changed event Oct 19, 2025
@Fedik Fedik changed the base branch from 6.0-dev to 6.1-dev October 19, 2025 10:56
@tecpromotion tecpromotion added the PBF Pizza, Bugs and Fun label Jan 23, 2026
@muhme
Copy link
Contributor

muhme commented Jan 23, 2026

@Fedik We are sorry, couldn't test it. We applied PR and run npm ci, created custom HTML module with given content, inserted the code in administrator/templates/atum/index.php, reloaded backend page and moved the custom site module around in the list of site modules, but no console log. What could be missing?

@Fedik
Copy link
Member Author

Fedik commented Jan 23, 2026

the custom site module around in the list of site modules, but no console log. What could be missing?

Need to move the subform rows from the example 😉
Or any other subform, can also try create Custom field "subfrom" for article, and test it there.

@muhme
Copy link
Contributor

muhme commented Jan 23, 2026

I have tested this item ✅ successfully on 474b6b7

Tested with JBT

  • Applied PR with Patch Tester and running npm run build:js
  • Inserted the JS-snippet in administrator/templates/atum/index.php in the beginning, after $wa is set
  • Created Number field and Text field first and Subform field second with the number and the text field
  • in the backend, in the subform field configuration, moving the second field in first place or back, always results in the console log message
    This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46093.

@richard67
Copy link
Member

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jan 23, 2026
@richard67 richard67 removed the PBF Pizza, Bugs and Fun label Jan 23, 2026
@HLeithner HLeithner added this to the Joomla! 6.1.0 milestone Jan 24, 2026
@HLeithner HLeithner merged commit 4566cf0 into joomla:6.1-dev Jan 24, 2026
51 checks passed
@HLeithner
Copy link
Member

@Fedik thanks, could you please create/update documentation in the manual for it?

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jan 24, 2026
@HLeithner HLeithner added RTC This Pull Request is Ready To Commit Documentation Required labels Jan 24, 2026
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jan 24, 2026
@Fedik Fedik deleted the subform-order-event branch January 24, 2026 10:39
@Fedik
Copy link
Member Author

Fedik commented Jan 26, 2026

There it is:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Required Feature NPM Resource Changed This Pull Request can't be tested by Patchtester PR-6.1-dev

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants