Forums

Delete Clone Button Stops working after update from 7.0.10 to 7.0.11

CraigH 31 Jul, 2023
In a form with a repeating group, that includes a button with a "delete clone" repeater action, the button stops working after updating Chronoforms 7.0.10 to 7.0.11.
If you reinstall 7.0.10 back it works again.
I have tried resaving the form after update and that did not help.
CraigH 01 Aug, 2023
It seems there is a change from 7.0.10 to 7.0.11 in file:
/plugins/system/chronog3_plg/chronog3/assets/js/g3.boot.js

from:

		if($.G3.forms != undefined){
				$.each($(this).find('.chronopage').addBack('.chronopage'), function(Fi, Page){
					$.G3.forms.ready($(Page));
				});
			}


to:

		if($.G3.forms != undefined){
				if ($(this).find('.chronopage').length > 0){
					$.each($(this).find('.chronopage').addBack('.chronopage'), function(Fi, Page){
						$.G3.forms.ready($(Page));
					});
				}else{
					$.G3.forms.ready($(this));
				}
			}


This has two effects on repeater groups:
1) It FIXES the ability to toggle show/hide fields in a repeat group as described on topic:
https://www.chronoengine.com/forums/topics/view/110547/chronoforms-7-show-hide-fields-in-a-repeater-area-loop

2) It BREAKS the ability to delete clones within the repeat group.

I do not know the code well enough to know how to fix this so that both toggling show/hide and delete clone buttons work.
Zubairsk 01 Aug, 2023
- Issue: Delete Clone button not working after update from 7.0.10 to 7.0.11
- Steps to reproduce?
- Tried clearing cache/cookies?
- Any error messages?
- Check browser compatibility.
- Isolate the problem, test on different setups.
- Report the bug to developers.
CraigH 01 Aug, 2023
1 Likes
Hi Zubairsk

I thought this forum was the place to report issues to the chronoforms dev team?
I will describe here in more detail the simple test case and also use the contact form.

Reproduced on Joomla3.10 and Joomla4.3.3 both with php 8.1.21
First create the form with either Chronoforms 7.0.10 or 7.0.11 installed, it doesnt matter which.

1 Create a new advanced form, give it a name and add debug to the settings advanced options.
2 In the Pages view, add a text field and either leave names defaulted or edit the names
3 In the pages view add a repeater area, give it unit name "attendee_loop"
3a Add cloner to the advanced settings in the repeater area, and set minumum to 1, max to 10, and not sortable.
4 In the repeater loop add a text field, and give it unit name attendee_name.#attendee_loop
5 In the repeater loop add a button, and set type to "Button" and set the button text to "remove attendee"
5a Add "cloner settings" to the advanced section of this button and set the action to delete clone for repeter area "attendee_loop"
6 Add a button outside of the repeat loop and set the type to "Button" and set the button text to "Add attendee"
6a Add "cloner settings" to the advanced section of this button and set the action to "Add clone" for the repeater group "Attendee_loop"
7 Save the form
8 Add a menu item to load the form in the Joomla frontend

What happens when 7.0.10 is installed:
The form displays initially with a single repeat, with the single field "Attendee name" (no remove button present as expected)
When you click the Add attendee button, a second, repeat is created with both the "Attendee name" and "Remove attendee" button present.
Similarly, clicking multiple times creates repeats of both these fields.
When you click "Remove attendee, the associated clone is deleted from the form.

This is all working as expected.

What happens when 7.0.11 is installed:
The same as above for 7.0.10 except the "Remove attendee" button has no affect. When pressed nothing happens and there are no error messages in the Chrome developer tools console.

Simply commenting out line 443 in 7.0.11 version of /plugins/system/chronog3_plg/chronog3/assets/js/g3.boot.js
	}else{
		//$.G3.forms.ready($(this));
	}


restores the behaviour seen in 7.0.10, ie the "remove attendee" button with the delete clone action starts to work again.

However, this edit is not a good fix. I say this because the version 7.0.11 of chronoforms has a fix for the issue discussed in topic 110547
https://www.chronoengine.com/forums/topics/view/110547/chronoforms-7-show-hide-fields-in-a-repeater-area-loop
And the above edit breaks this fix.
Eddi Bournell 05 Mar, 2024
This fix works fine. The delete Button works again.
(show/hide individual clone is not relevant to me)
You need to login to be able to post a reply.