No Code Attached Yet
avatar DelPoint
DelPoint
2 Oct 2021

Note: the problem can be reproduced only if a template has subforms in its templateDetails.xml, and you try to modify/save template parameters. So, I've provided a very minimalistic template (no front-end fancyness) to demonstrate the issue. Use that for testing.

Steps to reproduce the issue

  1. Install vanilla J! 4.03 (stable) w/o demo data.
  2. Install template test attached: test.zip
  3. Go to System -> Site Template Styles -> test - Default style to change template's parameters.
  4. Switch to Advanced tab/panel.
  5. Add a (parent) subform by clicking the green '+' (plus) button next to the parameter I have Problems.
  6. Add a (child) subform by clicking the green '+' button next to the parameter Child Subform
  7. You should see ONE (parent) subform with ONE (child) subform on your screen - see expected result.
  8. Now click on the Save button to save the template parameters.
  9. After saved, and page refreshed, you will see that the parent subform is duplicated w/o a (child) subform, and also the subform w/ subform (created by the user) is on the screen - see actual result below.

Expected result

Expected Result

Actual result

Actual Result

System information (as much as possible)

Apche 2.4.46
PHP 8.03
MySQL 5.6.17
Joomla! 4.03

Additional comments

  1. Duplicated (parent) subform also saved into the MySQL database.
  2. If we change the user actions a bit:
  • add the 1st (parent) subform AND click Save BEFORE adding the 2nd (child) subform
  • THEN now add the child subform
  • AND now click Save again -> no duplicated subforms will be created
    That suggests maybe this is an error caused by Save: duplicated entries got pushed into the DB, and after page refreshed, DB sent back 2 subforms. Didn't have time for more debugging though.
  1. I also noticed that J! built-in field editor doesn't produce this kind of error. So, I've seen the problem only around the editing of template parameters.
  2. And a final observation: duplicated subform is always inserted BEFORE the subform created by the user, and never after it.
avatar DelPoint DelPoint - open - 2 Oct 2021
avatar joomla-cms-bot joomla-cms-bot - change - 2 Oct 2021
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 2 Oct 2021
avatar nozaro33
nozaro33 - comment - 2 Oct 2021

I've also replicated this problem with Joomla 4.0.3, used inside a config.xml

avatar Fedik
Fedik - comment - 2 Oct 2021

I can confirm,
it worked in past somehow :)

avatar Fedik Fedik - change - 2 Oct 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-10-02 13:40:25
Closed_By Fedik
avatar Fedik Fedik - close - 2 Oct 2021
avatar Fedik
Fedik - comment - 2 Oct 2021

please test #35726

avatar DelPoint
DelPoint - comment - 2 Oct 2021

Hi Fedik,

I can confirm that #35726 solves the duplication of subforms when saved, but it breaks showon functionality now.

Add a second field to the (child) subform with showon condition, which refers to the 1st field of this (child) subform. Condition: showon="first_field!:" (ie. if 1st field empty, 2nd field shouldn't appear).
Using your commit/modifications, as soon as I've added the 2nd (child) subform, ALL fields appeared in this form, ignoring the showon condition of the 2nd field.
Attached a modified test_2 template, where I've added a 2nd field into the (child) subform with showon condition.
Test your commit with this XML now, you'll see what I've described above.
test_2.zip

Also noticed: if a field with showon condition displayed while it shouldn't, and this field is a radio button group (the fancy one), then these buttons are not clickable. I guess, this is a side effect of JS implementation of "showon".

Add a Comment

Login with GitHub to post a comment