Using conditional in children content-type allows deletion of last group in GroupX
Hi, there seems to be a bug in the behavior of the (+) and (-) buttons in GroupX fields.
When I have more than 2 GroupX in the same form, the minus button can make the whole groupX's children fields disappear, even the last ones. This is true, thought I set 1 as the minimum number of groups in the GroupX parameters.
See for yourself :
- with only 1 groupX on this page : if you click (+) once, then (-) twice, the last group remains here and can't be deleted (as expected).
- with 2 groupX on this page : if you do the same, the fields inside the grey border disappear, leaving only a an empty grey rectangle :(
After further inspection, I see that when only one GroupX is present in the content-type, the classes "cck_form_group_x_first" and "cck_form_group_x_last" are created correctly, and they seem to prevent the last group to be deleted. However, when there are 2 or more GroupX in the same content-type, these classes don't get created as expected. As a result, the last remaining group doesn't have both classes (sometimes the former is missing, sometimes the latter) and it can be deleted with a last click on the (-).
I looked at the file cck_field/group_x/assets/js/script2.js, but couldn't fix it so I don't have a PR to propose to you...
-Mathieu
(See this in the Forum : https://www.seblod.com/community/forums/forms-content-types/multiple-groupx-plus-minus-bug)
Hi, do I have to do something more, or explain the bug differently ?
I can't reproduce this issue with current Seblod 3.10
One of the fields of the child content-type seems to mess with the +/- buttons. I will try on a fresh install and come back to you when I have found it.
At think I pinned it : the bug happens when the child content-type uses a conditional state. I made this test URL with :
- only 1 groupX,
- a minimal child content-type (3 simple fields),
- a conditional state on the alias field (is Visible), triggered by the value of the radio button.
This does not depend on the triggering field : Radio field and Simple Select field work the same. This also does not depend on the type on condition : any condition reproduces the issue. All files are pure Joomla 3.6.4 + Seblod 3.10.0, no override, no javascript added.
Do you have a plan to allow conditional states in children content-types ?
This bug is easy to reproduce and seems a big issue.
-Mathieu
Is there anyone following this bug ? The test URL given just above is still available.
Hi Mat is this happen on admin form as well ?
Hi Viktor, I only tested it in front-end forms.
Hello @Mat-o, A few javascript issues have been fixed in the "Group X" script. Could you please try again to see if that helped ? Thanks, Saba
This is resolved since 12 months at least already... Sorry for the delay!