Conflict related to field_group and ajax buttons

Created on 20 June 2025, 13 days ago

First of all, let me know if you consider this to be a bug in Field Group.

Problem/Motivation

There's a conflict that's triggered only when all of the following are true:

  • You have a node edit form with more than one tab (from the field_group module)
  • A tab has a field with a required value
  • You have a field that allows creation of multiple instances through an ajax call
  • You have sam installed
  • You have a field set to allow multiple values, causing sam to kick in

Steps to reproduce

Install sam and field_group

Set up a content type with these fields:

Set up three field groups, one "Tabs" and two "Tab". Use the defaults and place the fields like this:

Then, add a node of the test content type.

Follow the clicks in the attached screen recording.

If you place a breakpoint here inside the sam_simplify.js, you'll notice that the first time and second time (after the form has been redrawn using ajax) there's different numbers of handlers being executed:

First time:

Second time (after the form has reloaded through ajax):

The actual problem appears when the second handler is executed:

Here, the field_group module checks for validity and that module will then focus the first tab, since there's a field thet that doesn't pass validation.

Proposed resolution

Make sure the sam module doesn't run the script from other modules (such as field_group), that cause the validity of form elements etc. to be considered.

A click before and after the ajax reloading of a form should behave the same way.

Remaining tasks

Figure out what exactly can be done to prevent the field_group javascript to be added to the button's list of handlers.

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Active

Version

1.3

Component

Code

Created by

🇳🇴Norway svenryen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024