Forums

CF7 - Deleting a clone containing fields with validation

CraigH 24 Nov, 2023
If you have a form with a repeating area which includes fields with validation assigned, such a "required". Then if you delete a clone and then submit the form you get a JS console error: "Transition: Element is no longer attached to DOM. Unable to animate. Use silent setting to supress this warning in production. scale in".

If you populate all validated fields before deleting the clone all is fine. But not very user friendly to cater for click happy customers who add one too many clones.

Joomla 5
PHP:8.2
CF:7.0.12
CraigH 24 Nov, 2023
Think I have found the fix. If you edit line ~939 in file ~/plugins/system/chronog3_plg/chronog3/assets/js/g3.forms.js

ie the function definition for Form.on('click', '.delete_clone', function()

and change from:
jQuery.G3.forms.repeater.update(container);
jQuery.G3.forms.initializeForm(Form);


to:
jQuery.G3.forms.repeater.update(container);
jQuery.G3.forms.initializeForm(container.closest('form'));


That seems to do the trick!
You need to login to be able to post a reply.