When using Site Studio 7.x with Gin 3.0-rc2 we are unable to save a very simple content type that contains only a layout field. When trying to save we get the error

Uncaught TypeError: Cannot read properties of undefined (reading 'value')
    at HTMLFormElement.H (app.js?ru6zhp:42:50366)

looking at the referenced code it is trying to find a submit button

       function H(e) {
           e.preventDefault();
           const t = document.querySelectorAll(`#${u.default.cohesion.drupalFormId} input[type="submit"]`)[0];
           M = s.default.get(e, "submitter.value", t.value),
           r()
       }

It appears that Gin has moved the submit button outside of where Site Studio is looking for it which prevents the node from being saved.

As a workaround we've found that placing a media reference field to the content type places a submit button inside the node form allowing the content to be saved. This seems to work fine but it's unclear if bypassing the js in this way will have any unseen or future impacts.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ctrlADel created an issue. See original summary.

bakulahluwalia’s picture

We switched the theme from Gin to Claro till we have any patch or fix available. Legit issue.

bakulahluwalia’s picture

Priority: Normal » Major
pavlosdan’s picture

Status: Active » Postponed (maintainer needs more info)

I can't replicate this with Gin 3.0.0-rc3, Site Studio 7.1.0, and Site Studio Gin 1.0.0 and a basic content type with only a body field on it.

Is this still an issue?

kevinfunk’s picture

@pavlosdan can you test with Component content?

I can replicate the issue trying to create Component content using Drupal 10.0.9, Gin 3.0-rc3, Site Studio 7.1.1, and Site Studio Gin 1.0.0.

aamouri’s picture

Hello,

I have the same problem when I try to save a site studio component content.

I will try to find a workaround with a patch.

Thx.

pavlosdan’s picture

Status: Postponed (maintainer needs more info) » Postponed

I was able to replicate this for content types as well by adding a layout canvas field to it. Not sure why adding a media reference field makes it work as the key issue seems to be that Site Studio is looking for the form submit button within the Drupal form:

`#${drupalSettings.cohesion.drupalFormId} input[type="submit"]` 

I've recommended to the Site Studio team that the selector be changed to the following:

const defaultSubmitEl = document.querySelectorAll(
  `input[type="submit"][form="${drupalSettings.cohesion.drupalFormId}"]`
)[0];

so the submit button can be found wherever it is placed as Gin places the buttons outside of the form which is still valid https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-form)

Marking this as "postponed" until we see whether Site Studio will be able to incorporate the change. Meanwhile if people find any good workarounds, merge requests are welcomed.

pavlosdan’s picture

Status: Postponed » Needs review
StatusFileSize
new1.36 KB

Had a chat with Martin the other day about this. Here's a patch to hopefully unblock people until we get a fix incorporated into Site Studio.

Please review and let us know if this works.

kevinfunk’s picture

Status: Needs review » Reviewed & tested by the community

The patch has unblocked me!

kevinfunk’s picture

Status: Reviewed & tested by the community » Needs work

I'm getting an error when trying to edit a Webform.
Error: Call to undefined method Drupal\webform\Entity\Webform::getFieldDefinitions() in sitestudio_gin_form_alter() (line 114 of /sitestudio_gin/sitestudio_gin.module).

kevinfunk’s picture

Status: Needs work » Needs review
StatusFileSize
new1.5 KB
new946 bytes

Patch should fix issues with all entities that are not fieldable.

ctrladel’s picture

Status: Needs review » Reviewed & tested by the community

Applied the patch in #12 and everything appears to be in working order on our sites. Setting RTBC.

Rajeshreeputra made their first commit to this issue’s fork.

  • mandclu committed 0b961b7f on 1.0.x
    Issue #3358530 by pavlosdan, kevinfunk, Rajeshreeputra: Unable to save...
mandclu’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.