Project

General

Profile

Actions

Bug #82179

closed

FormEngine triggers link explanation when new links are created, when it shouldn't

Added by Johannes Schlier about 7 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Category:
Backend JavaScript
Target version:
Start date:
2017-08-23
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If there are links on a backend form they are correctly initialised by FormEngine.js with the following code on lines 1005-1022:

    FormEngine.initializeInputLinkToggle = function() {
        var toggleClass = '.t3js-form-field-inputlink-explanation-toggle',
            inputFieldClass = '.t3js-form-field-inputlink-input',
            explanationClass = '.t3js-form-field-inputlink-explanation';

        // if empty, show input field
        $(explanationClass).filter(function () {
            return !$.trim($(this).val());
        }).each(function () {
            var $group = $(this).closest('.t3js-form-field-inputlink'),
                $inputField = $group.find(inputFieldClass),
                $explanationField = $group.find(explanationClass),
                explanationShown;
            explanationShown = !$explanationField.hasClass('hidden');
            $explanationField.toggleClass('hidden', explanationShown);
            $inputField.toggleClass('hidden', !explanationShown);
            $group.find('.form-control-clearable button.close').toggleClass('hidden', !explanationShown)
        });

This works correctly the first time, but if a new link is created, as an IRRE element for example, the same code is executed again.
This means that the line

            explanationShown = !$explanationField.hasClass('hidden');

gives a different result and all link fields that are empty (or not empty, but not yet saved), are triggered again, even though they shouldn't. This leads to the empty explanation field being shown, which cannot be triggered to the input field again.
Creating another link after this triggers them again with the same result as the first time - with the input field shown, not the explanation field. And so on ...

Actions #1

Updated by Gerrit Code Review about 7 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53790

Actions #2

Updated by Gerrit Code Review about 7 years ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53826

Actions #3

Updated by Johannes Schlier about 7 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #4

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF