SEBLOD icon indicating copy to clipboard operation
SEBLOD copied to clipboard

Using conditional in children content-type allows deletion of last group in GroupX

Open Mat-o opened this issue 9 years ago • 10 comments

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)

Mat-o avatar Oct 06 '16 13:10 Mat-o

Hi, do I have to do something more, or explain the bug differently ?

Mat-o avatar Oct 11 '16 12:10 Mat-o

I can't reproduce this issue with current Seblod 3.10

klas avatar Nov 07 '16 13:11 klas

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.

Mat-o avatar Nov 07 '16 16:11 Mat-o

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.

Mat-o avatar Nov 14 '16 15:11 Mat-o

Do you have a plan to allow conditional states in children content-types ?

Mat-o avatar Nov 18 '16 10:11 Mat-o

This bug is easy to reproduce and seems a big issue.

-Mathieu

Mat-o avatar Dec 08 '16 11:12 Mat-o

Is there anyone following this bug ? The test URL given just above is still available.

Mat-o avatar Mar 03 '17 13:03 Mat-o

Hi Mat is this happen on admin form as well ?

ViktorIwan avatar Mar 03 '17 18:03 ViktorIwan

Hi Viktor, I only tested it in front-end forms.

Mat-o avatar Mar 03 '17 20:03 Mat-o

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

sebastienheraud avatar Jul 10 '18 16:07 sebastienheraud

This is resolved since 12 months at least already... Sorry for the delay!

Mat-o avatar Sep 03 '22 08:09 Mat-o