Issue Bug Closed

#96135IRRE: Hide Record switch not work

Devid Messner 11/29/21, 13:13 updated 08/11/26, 08:46

Description

If you have an inline record open and then click Hide in the MenuBar, the record is greyed out, but after saving the main record this setting is lost.

The Hide field in the Inline Record, on the other hand, works without problems.

When the inline record is closed, the hide function in the menu bar works normally.

Attached is an example of the extension “news”

Reviews 5

Files 4

History 3442

Show 17 earlier messages
  1. Benni Mack commented and changed status New Accepted <span data-processor="relativetime" data-value="2021-12-14T14:35:28+00:00" > 12/14/21, 14:35 </span>

    Hey Devid,

    yes. I can already imagine why this is the case. The issue is that the hide/unhide works, but as soon as you hit the save button, the form (POST data) is submitted and the value of the checkbox/toggle field is used, overriding the previous action.

  2. Devid Messner commented <span data-processor="relativetime" data-value="2021-12-16T07:30:19+00:00" > 12/16/21, 07:30 </span>

    Benni Mack wrote in #note-1:
    > Hey Devid,
    >
    > yes. I can already imagine why this is the case. The issue is that the hide/unhide works, but as soon as you hit the save button, the form (POST data) is submitted and the value of the checkbox/toggle field is used, overriding the previous action.

    Hey,
    Yes probably. Another interesting behavior is,
    that if the “Hidden” field does not have the “invertStateDisplay” set, the actions may be reversed. Depending on the initial value of the hidden field, when the hidden button in the icon bar is activated, the field in the form is deactivated. Thus the status of the two buttons is no longer syncron.

  3. Ralph Pöllath commented <span data-processor="relativetime" data-value="2022-05-04T09:58:33+00:00" > 05/04/22, 09:58 </span>

    @Devid Messner
    I had the same problem. Thanks for the tip.

  4. Sascha Zander commented and changed attached debugging_process_cmdmap.png <span data-processor="relativetime" data-value="2022-08-04T09:32:08+00:00" > 08/04/22, 09:32 </span>

    @Benni Mack
    On my TYPO3 10.4.30 Projects i have the same issue but i don’t have the “hidden”-field in the show list of the IRRE TCA.
    If i debugg the \TYPO3\CMS\Core\DataHandling\DataHandler::process_cmdmap and if i check the value of the IRRE in “$this->cmdmap” the “hidden”-field is only set on the items that has not open by the editor. On the items that was open it is missing the “hidden”-field and his new value.

  5. Daniel Hoffmann commented <span data-processor="relativetime" data-value="2022-08-08T15:35:55+00:00" > 08/08/22, 15:35 </span>

    I have done some research:

    *When the IRRE item is NOT expanded*
    the switch works as expected.

    *When the IRRE item is expanded and the hidden toggle is not shown in the expanded area*
    it is not possible to change the state of the expanded IRRE item

    *When the IRRE item is expanded and the hidden toggle is shown with renderType ‘checkboxToggle’ and invertStateDisplay = false*
    it is possible to use both toggles and everything works fine, but for the editor it is difficult, because the switch in the “Header-Bar” shows the inverted State of the switch in the “Content-Area” of the irre Item

    *When the IRRE item is expanded and the hidden toggle is shown with renderType ‘checkboxToggle’ and invertStateDisplay = true*
    The toggle in the expanded area works like expected.
    The toggle in the “Header-Bar” does not work

    I tried to find the bug and fix it, but ended up in some javascript, where my knowledge is not very high.

    I think the problem is the click event on the toggle in the “Header-Bar”, it does not recognize the invertedState of the button in the “Content-Area” and changes the value not correct then.

  6. Peter Wimmer commented <span data-processor="relativetime" data-value="2022-08-31T14:19:51+00:00" > 08/31/22, 14:19 </span>

    As an additional comment / temporary improvement:

    I changed the TCA for the hidden field to “check” and “invertStateDisplay” = false. So the “hidden” input element looks like in older version, just a checkbox. This works.

    $GLOBALS['TCA']['<TABLENAME>']['columns']['hidden']['config']['renderType'] = 'check';
    $GLOBALS['TCA']['<TABLENAME>']['columns']['hidden']['config']['items'][0]['invertStateDisplay'] = false;

    So it could be that there was no change in the javascript, it was just the change from “invertStateDisplay” false => true in TYPO3 11…

    This fix will then most likely break again if a real fix is implemented. It should work, but most likely it will not.

  7. Christian Buelter commented <span data-processor="relativetime" data-value="2022-09-20T14:09:23+00:00" > 09/20/22, 14:09 </span>

    I had the same problem with mask elements.
    That workaround helped. Thanks.

    Peter Wimmer wrote in #note-6:
    > As an additional comment / temporary improvement:
    >
    > I changed the TCA for the hidden field to “check” and “invertStateDisplay” = false. So the “hidden” input element looks like in older version, just a checkbox. This works.
    >
    > […]

  8. websedit AG commented <span data-processor="relativetime" data-value="2022-11-07T07:28:05+00:00" > 11/07/22, 07:28 </span>

    Hello everyone,

    we are facing the same problem in one of our customer projectes.
    Is it already foreseeable when a solution will be available?

    Kind regards!

  9. Nick Aumann commented <span data-processor="relativetime" data-value="2023-12-01T12:07:30+00:00" > 12/01/23, 12:07 </span>

    Is work on the bug planned? Will there be a patch for it?

    See it on sprint board https://forger.typo3.com/sprint/core/9

  10. Fabian Haider commented <span data-processor="relativetime" data-value="2024-02-28T09:37:22+00:00" > 02/28/24, 09:37 </span>

    Ulrich Mathes wrote in #note-11:
    > Still a problem in TYPO3 12 and TYPO3 13

    I’m having the same issue on a customer project on TYPO3 11, hope there will be a solution soon!

  11. Jan Kornblum commented <span data-processor="relativetime" data-value="2024-04-08T09:04:32+00:00" > 04/08/24, 09:04 </span>

    I can confirm the problem exists in 11 LTS. Toggle the “hide” button within the inline elements header bar (inline element collapsed) does not work. Directly toggle the “hide” button within the expanded child content area works instead. In my case there is “ ‘invertStateDisplay’ => true”. Should be fixed soon!

  12. Fabian Haider commented and changed TYPO3 Version 11 12 PHP Version 7.4 8.2 <span data-processor="relativetime" data-value="2024-07-16T12:01:59+00:00" > 07/16/24, 12:01 </span>

    updated the project to TYPO3 12.4 and i can confirm that the problem still exists to this day

  13. Philipp Gollmer commented <span data-processor="relativetime" data-value="2024-08-14T09:06:26+00:00" > 08/14/24, 09:06 </span>

    I can confirm same behavior still in v13.2.1 (PHP 8.3)

    Used invertStateDisplay true
    collapsed element => works
    expanded element => does not work

  1. Ingo Hollmann commented <span data-processor="relativetime" data-value="2024-12-13T14:30:26+00:00" > 12/13/24, 14:30 </span>

    I have this problem too, and it annoys our customer.
    So i had to dig a little bit and it seems the problem lies on the invert state which is noch checked here:
    https://github.com/TYPO3/typo3/blob/main/Build/Sources/TypeScript/backend/form-engine/container/inline-control-container.ts#L434

    I hat to Fix this, so here is a patch that works for TYPO3 v11.5, it’s not the best but it works. Maybe someone kann use this as base for a fix

    diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/InlineControlContainer.ts b/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/InlineControlContainer.ts
    index eac224ea5ee..1738aceaef2 100644
    --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/InlineControlContainer.ts
    +++ b/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/InlineControlContainer.ts
    @@ -41,6 +41,7 @@ enum Selectors {
       revertUniqueness = '.t3js-revert-unique',
       controlContainer = '.t3js-inline-controls',
       controlTopOuterContainer = '.t3js-inline-controls-top-outer-container',
    +  recordHiddenInput = '[type="hidden"][name$="][hidden]"]',
     }
    
     enum States {
    @@ -260,6 +261,7 @@ class InlineControlContainer {
         this.registerSynchronizeLocalize();
         this.registerRevertUniquenessAction();
         this.registerToggle();
    +    this.registerToggelVisibility();
    
         this.registerCreateRecordBySelector();
         this.registerUniqueSelectFieldChanged();
    @@ -420,10 +422,26 @@ class InlineControlContainer {
           const hiddenFieldName = 'data' + recordContainer.dataset.fieldName + '[' + target.dataset.hiddenField + ']';
           const hiddenValueCheckBox = <HTMLInputElement>document.querySelector('[data-formengine-input-name="' + hiddenFieldName + '"');
           const hiddenValueInput = <HTMLInputElement>document.querySelector('[name="' + hiddenFieldName + '"');
    +      const hiddenValueInputChangeItems = JSON.parse(hiddenValueCheckBox.getAttribute('data-formengine-field-change-items'));
    +      let invert = false;
    +
    +      if (hiddenValueInputChangeItems) {
    +        hiddenValueInputChangeItems.forEach((i: any) => {
    +          if (i.name == 'typo3-backend-form-update-bitmask' && i.invert == 'true') {
    +            invert = true;
    +          }
    +        });
    +      } else {
    +        invert = true;
    +      }
    
           if (hiddenValueCheckBox !== null && hiddenValueInput !== null) {
             hiddenValueCheckBox.checked = !hiddenValueCheckBox.checked;
    -        hiddenValueInput.value = hiddenValueCheckBox.checked ? '1' : '0';
    +        if (invert) {
    +          hiddenValueInput.value = hiddenValueCheckBox.checked ? '1' : '0';
    +        } else {
    +          hiddenValueInput.value = hiddenValueCheckBox.checked ? '0' : '1';
    +        }
             FormEngineValidation.markFieldAsChanged(hiddenValueCheckBox);
           }
    
    @@ -549,6 +567,29 @@ class InlineControlContainer {
         }).delegateTo(this.container, Selectors.revertUniqueness);
       }
    
    +  private registerToggelVisibility () {
    +    const me = this;
    +    new RegularEvent('change', function(this: HTMLElement, e: Event) {
    +      const recordContainer = this.closest('[data-object-id]');
    +      const containerHiddenToggleBtn = <HTMLButtonElement>recordContainer.querySelector(Selectors.enableDisableRecordButtonSelector)
    +      const hiddenClass = 't3-form-field-container-inline-hidden';
    +      const isHidden = recordContainer.classList.contains(hiddenClass);
    +      let toggleIcon: string;
    +
    +      if (isHidden) {
    +        toggleIcon = 'actions-edit-hide';
    +        recordContainer.classList.remove(hiddenClass);
    +      } else {
    +        toggleIcon = 'actions-edit-unhide';
    +        recordContainer.classList.add(hiddenClass);
    +      }
    +
    +      Icons.getIcon(toggleIcon, Icons.sizes.small).then((markup: string): void => {
    +        containerHiddenToggleBtn.replaceChild(document.createRange().createContextualFragment(markup), containerHiddenToggleBtn.querySelector('.t3js-icon'));
    +      });
    +    }).delegateTo(this.container, Selectors.recordHiddenInput);
    +  }
    +
       /**
        * @param {string} objectId
        */
    @@ -579,6 +620,30 @@ class InlineControlContainer {
               FormEngineValidation.initializeInputFields();
               FormEngineValidation.validate(this.container);
    
    +          // Check hidden state of th Container and update the element if neccessary
    +          const inlineRecordContainerIsHidden = recordContainer.classList.contains('t3-form-field-container-inline-hidden');
    +          const containerHiddenToggleBtn = <HTMLButtonElement>recordContainer.querySelector(Selectors.enableDisableRecordButtonSelector)
    +          const hiddenFieldName = 'data' + recordContainer.dataset.fieldName + '[' + containerHiddenToggleBtn.dataset.hiddenField + ']';
    +          const hiddenValueCheckBox = <HTMLInputElement>recordFieldsContainer.querySelector('[data-formengine-input-name="' + hiddenFieldName + '"');
    +          const hiddenValueInput = <HTMLInputElement>recordFieldsContainer.querySelector('[name="' + hiddenFieldName + '"');
    +          const hiddenValueInputChangeItems = JSON.parse(hiddenValueCheckBox.getAttribute('data-formengine-field-change-items'));
    +          let invert = false;
    +          hiddenValueInputChangeItems?.forEach((i: any) => {
    +            if (i.name == 'typo3-backend-form-update-bitmask' && i.invert == 'true') {
    +              invert = true;
    +            }
    +          });
    +
    +          if (inlineRecordContainerIsHidden != (hiddenValueInput.value == (invert ? '0' : '1'))) {
    +            hiddenValueCheckBox.checked = !hiddenValueCheckBox.checked;
    +            if (invert) {
    +              hiddenValueInput.value = hiddenValueCheckBox.checked ? '1' : '0';
    +            } else {
    +              hiddenValueInput.value = hiddenValueCheckBox.checked ? '0' : '1';
    +            }
    +            FormEngineValidation.markFieldAsChanged(hiddenValueCheckBox);
    +          }
    +
               if (this.hasObjectGroupDefinedUniqueConstraints()) {
                 const recordContainer = InlineControlContainer.getInlineRecordContainer(objectId);
                 this.removeUsed(recordContainer);
  2. Garvin Hicking commented and changed attached ref-hiding-collapsed-working.gif attached ref-hiding-expanded-notworking.gif TYPO3 Version 11 12 Complexity hard <span data-processor="relativetime" data-value="2025-03-15T00:03:44+00:00" > 03/15/25, 00:03 </span>

    Current POC: https://review.typo3.org/c/Packages/TYPO3.CMS/+/88305 (fixes it for IRRE records, but not yet IRRE file references)

    Video of this attached.

  3. Gerrit Code Review pushed patch set 1 for main to change 92362 status Accepted Under Review <span data-processor="relativetime" data-value="2026-01-17T05:34:06+00:00" > 01/17/26, 05:34 </span>

  4. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-04-23T12:09:06+00:00" > 04/23/26, 12:09 </span>

    @Everyone: Please check out https://review.typo3.org/c/Packages/TYPO3.CMS/+/92362 for the recent version of a patch that at least for me seems to do the trick

  5. Benjamin Franzke commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-04-23T14:10:12+00:00" > 04/23/26, 14:10 </span>

    Applied in changeset commit:b5bb5fc8ed08ed279c9264c42d4aa500ff976643.