Unable to save very basic content type

Created on 5 May 2023, over 1 year ago
Updated 19 May 2023, over 1 year ago

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.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States ctrladel North Carolina, USA

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States bakulahluwalia Houston

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

  • πŸ‡ΊπŸ‡ΈUnited States bakulahluwalia Houston
  • Status changed to Postponed: needs info over 1 year ago
  • πŸ‡¨πŸ‡¦Canada pavlosdan

    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?

  • πŸ‡ΊπŸ‡ΈUnited States kevinfunk

    @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.

  • πŸ‡«πŸ‡·France aamouri

    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.

  • Status changed to Postponed over 1 year ago
  • πŸ‡¨πŸ‡¦Canada pavlosdan

    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

    `#${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.

  • πŸ‡¨πŸ‡¦Canada pavlosdan

    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.

  • Status changed to Needs review over 1 year ago
  • @pavlosdan opened merge request.
  • Status changed to RTBC over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States kevinfunk

    The patch has unblocked me!

  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States kevinfunk

    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).

  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States kevinfunk

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

  • Status changed to RTBC over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States ctrladel North Carolina, USA

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

  • First commit to issue fork.
    • mandclu β†’ committed 0b961b7f on 1.0.x
      Issue #3358530 by pavlosdan, kevinfunk, Rajeshreeputra: Unable to save...
  • Status changed to Fixed about 2 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024