Text not saving without clicking on other fields

Created on 25 May 2023, over 1 year ago
Updated 4 January 2024, 12 months ago

Problem/Motivation

- Making changes to textfield or textarea field, exclude WYSIWYG, and doing update or add block does not trigger a content save.

Steps to reproduce

  1. Enable Patternkit and Patternkit example module.
  2. Configure a node type and enable layout builder.
  3. Add a new content with layout builder enabled and fill out the required field.
  4. Go to layout builder tab.
  5. Add [Patternkit] Example block
  6. In the text field, add any text, but do NOT click on anyrthing else outside there.
  7. Click on add block
  8. Notice the text field did not get saved
  9. Go to configure block, notice the text field is empty.

Proposed resolution

Identify why content serialization isn't happening prior to AJAX form submission and ensure a final serialized value set is included in the AJAX callback.

Remaining tasks

  • Code review
  • Testing and feedback

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Fixed

Version

9.1

Component

Module Core

Created by

🇺🇸United States johnle

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

Comments & Activities

  • Issue created by @johnle
  • 🇺🇸United States slucero Arkansas

    I've been able to reproduce this locally and confirmed it does not occur in the Beta 6 release making this a regression. The other important identification is that this issue exists for all string fields, not just HTML fields that would otherwise have a WYSIWYG attached to them.

    My early testing has identified the following steps that were present in the Beta 6 version of the jsoneditor behavior, but these are missing from the beforeSubmit handler of the Beta 7 release.

             Drupal.Ajax.prototype.beforeSubmit = function (formValues, elementSettings, options) {
                 // [...]
                 let index = formValues.findIndex(function (o) {
                   return o.name === "settings[instance_config]";
                 });
                 if (index !== -1) {
                   window.patternkitEditor.disable();
                   formValues[index] = {
                     name: "settings[instance_config]",
                     value: JSON.stringify(window.patternkitEditor.getValue()),
                     type: "hidden",
                     required: false
                   };
                   window.patternkitEditor.destroy();
                   delete window.patternkitEditor;
                   $(once.remove('patternkit-editor', $target));
                 }
               }
             }
    

    Adding this back into the beforeSubmit handler seems to resolve the issue.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    316 pass, 2 fail
  • @slucero opened merge request.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    326 pass
  • 🇺🇸United States slucero Arkansas
  • Status changed to Needs review over 1 year ago
  • 🇺🇸United States slucero Arkansas
  • 🇮🇳India minsharm India

    I have retested the issue for both the below conditions on D9 and D10 website and we are good with the results.

    Condition 1-> "None" is selected for WYSIWYG editor under JSON Pattern library settings.

    Result -> Texts and formatted text fields are getting saved now even if do not click anywhere else outside there.

    Condition 2-> "CKEditor 5" is selected for WYSIWYG editor under JSON Pattern library settings.

    Result -> Text and formatted text are getting saved even if do not click anywhere else outside there.

  • Status changed to RTBC over 1 year ago
  • 🇺🇸United States slucero Arkansas
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    326 pass
    • slucero committed e62e88af on 9.1.x
      Issue #3362729 by slucero, johnle, minsharm: Text not saving without...
  • Status changed to Fixed over 1 year ago
  • 🇺🇸United States slucero Arkansas
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed 12 months ago
Production build 0.71.5 2024