NPM Resource Changed ? ? Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
23 Dec 2019

Pull Request for Issue #27307 .

Summary of Changes

This fixes a name duplication, that may happen in specific cases.

Testing Instructions

Apply patch, run npm install

Add subform field somewhere

<field name="test_fields" type="subform" label="test_fields" multiple="true" min="1" max="5">
  <form>
    <field name="test_field" type="text" label="TESTFIELD1"/>    
  </form>
</field>

Do steps described by @cinemarene in #27307:

Go to the form.
Now there is one row with key 0.
Add one row with "+" button.
Now there are two rows with 0 and 1.
Remove first row with key 0 over button "-".
Now there are one row with key 1.
Add one row with "+" button.
Now there are two rows with key 1 and 1.

Expected result

You do not have duplicated field names

Actual result

You have duplicated field names

Documentation Changes Required

none

avatar Fedik Fedik - open - 23 Dec 2019
avatar Fedik Fedik - change - 23 Dec 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 23 Dec 2019
Category JavaScript Repository NPM Change
312569e 23 Dec 2019 avatar Fedik hound
avatar Fedik Fedik - change - 23 Dec 2019
Labels Added: NPM Resource Changed ?
0a8f30e 23 Dec 2019 avatar Fedik hound
avatar richard67
richard67 - comment - 30 Dec 2019

@Fedik Could you click the "Update branch" button at the bottom of your PR? I'd like to see if appveyor and drone will pass this time. Thanks in advance.

avatar Fedik
Fedik - comment - 30 Dec 2019

it pass this time :)

avatar richard67
richard67 - comment - 30 Dec 2019

Is like winning in lotto with the drone ;-)

avatar richard67
richard67 - comment - 30 Dec 2019

will test later.

avatar richard67 richard67 - test_item - 30 Dec 2019 - Tested successfully
avatar richard67
richard67 - comment - 30 Dec 2019

I have tested this item successfully on 74bbd66

Tested with subform in "Users Options" > "Email Domain Options".


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

avatar richard67
richard67 - comment - 30 Dec 2019

@cinemarene @ReLater Please test.

avatar ReLater
ReLater - comment - 30 Dec 2019

@ReLater Please test.

Sorry, I can't whenever npm is needed for testing.

avatar richard67
richard67 - comment - 31 Dec 2019

@alikon Do you think you can test this PR? No need to add field code somewhere, you can use subform in "Users" -> "Manage" -> "Options" -> "Email Domain Options". You can add and remove rows with domain rules as described in the testing instructions and check the IDs of the fields with browser tools.

avatar Fedik
Fedik - comment - 31 Dec 2019

in theory it should be just enough to run node build.js --compile-js for update the script of the custom element, instead of full npm install

avatar richard67
richard67 - comment - 31 Dec 2019

@Fedik Yes, I know, it works, but that doesn't help those people who don't have node installed ;-)

avatar Fedik
Fedik - comment - 31 Dec 2019

yeah, that true :)

avatar alikon alikon - test_item - 1 Jan 2020 - Tested successfully
avatar alikon
alikon - comment - 1 Jan 2020

I have tested this item successfully on 74bbd66


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

avatar alikon alikon - change - 1 Jan 2020
Status Pending Ready to Commit
avatar alikon
alikon - comment - 1 Jan 2020

RTC


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

avatar HLeithner HLeithner - change - 1 Jan 2020
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-01-01 08:59:35
Closed_By HLeithner
Labels Added: ?
avatar HLeithner HLeithner - close - 1 Jan 2020
avatar HLeithner HLeithner - merge - 1 Jan 2020
avatar HLeithner
HLeithner - comment - 1 Jan 2020

Thanks

avatar continga
continga - comment - 7 Jan 2020

As far as I know, the fix from #22757 was necessary to fix that data is not being saved correctly when having nested subforms - see #22441 @dawe78 reports:

Its not the id only, the issue affects name too - so saving fails.

@Fedik wrote in #27334 (the J!3 version of this PR):

In general, random row numbers does not lead to any functional issue.

So I have to disagree, see also #22690 !

#22757 was to fix those 2 bugs. I see now that it introduced a new bug, but just reverting the changes from #22757 will not help us very much, as those two older bugs now will be reintroduced. I still have to test this PR whether that is really the case, but we should really discuss whether we have a better solution to this than just reverting

avatar Fedik
Fedik - comment - 7 Jan 2020

So I have to disagree, see also #22690 !

You will have random numbers anyway.
In backend (server side) you should always do $value = array_values($value) (or use foreach) to get the list of rows, without these numbers.

avatar continga
continga - comment - 7 Jan 2020

@Fedik it is not about random numbers. Please read #22690 thoroughly. The issue is about having nested subforms (a subform inside of a subform) and then adding a new row in the inner-most subform. This row will have the wrong name of its parent row and hence the backend cannot know to which outer subform row this inner childrow belongs.

avatar Fedik
Fedik - comment - 7 Jan 2020

okay, I see, children loosing parent :)

Well, but that not a fix #22757 anyway, it need to debug more, to find how to prepare a name, especially for children (need to avoid of losing a parent group somehow).

j4 and j3 has different handling of children:
j3 have one subform instance common for all nested forms
j4 have one subfrom instance per nested

That bug for j3, need to test how it work in j4.

Add a Comment

Login with GitHub to post a comment