Project

General

Profile

Actions

Bug #77257

closed

Story #69617: FormEngine bugs

The selection of a selectbox with the l10n_display type of defaultAsReadonly in TCA is wrong for a localized record

Added by M. Stichweh over 8 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
FormEngine aka TCEforms
Start date:
2016-07-26
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

If a non-translatable selectbox is rendered within a localized record with defaultAsReadonly type for l10n_display only the first character of the selected uid is used to set the selected value. The problem is in line 95 of the SelectSingleElement class:

if (!empty($parameterArray['itemFormElValue'])) {
    $selectedValue = (string)$parameterArray['itemFormElValue'][0];
}

An array is expected here but in this case, a localized item with a non-translatable select field, the value of itemFormElValue is a string.

Here is an example for the TCA config:

'foo' => array(
  'l10n_mode' => 'exclude',
  'l10n_display' => 'defaultAsReadonly',
  'config' => array(
    'type' => 'select',
    'renderType' => 'selectSingle',
    'foreign_table' => 'tx_example_domain_model_foo'
  )
)

Related issues 5 (1 open4 closed)

Related to TYPO3 Core - Bug #77155: PHP Warning: Invalid argument supplied for foreach() in backend/Classes/Form/Element/SelectMultipleSideBySideElement.php line 66ClosedChristian Kuhn2016-07-19

Actions
Related to TYPO3 Core - Bug #84997: Localized records with rendertype selectCheckBox + defaultAsReadonly generate PHP warningsClosed2018-05-14

Actions
Related to TYPO3 Core - Bug #82843: TCA: localized `SelectSingleElement` selects wrong optionClosed2017-10-23

Actions
Related to TYPO3 Core - Bug #81996: Read ony select field 'renderType' => 'selectSingle' renders all available itemsNew2017-07-28

Actions
Is duplicate of TYPO3 Core - Bug #76785: Wrong Selected option in localised TCA columns of type select when l10n_mode="exclude"Closed2016-06-24

Actions
Actions #1

Updated by Markus Klein over 8 years ago

  • Status changed from New to Needs Feedback

I'm not sure about your usecase.
While I agree that the value of the option is not nice to be just a character, I have to ask what the intention is.
If a fields is an excluded one, no value at all should be stored into DB (not sure if that is the case currently though) or at least on evaluation in FE always the value of the parent record will be taken, the actual value in the translation does not matter.

Actions #2

Updated by M. Stichweh over 8 years ago

Markus Klein wrote:

I'm not sure about your usecase.
While I agree that the value of the option is not nice to be just a character, I have to ask what the intention is.
If a fields is an excluded one, no value at all should be stored into DB (not sure if that is the case currently though) or at least on evaluation in FE always the value of the parent record will be taken, the actual value in the translation does not matter.

For example you could have a list of books and for each book you have to select an author. The author is selected by a selectbox which is filled by another table. The author field is not localizable and can only be selected in the default language of the book. If this field is configured with defaultAsReadonly for l10n_display the author should be displayed in a localized dataset of a book. The authors table has the items "John Doe" with uid 123 and "Jane Doe" with uid 1. If you select the author "John Doe" with uid 123 only uid 1 is used to select the author in a localized book. So in the localized version of the book "Jane Doe" is displayed.

Actions #3

Updated by Markus Klein over 8 years ago

  • Status changed from Needs Feedback to New
  • Priority changed from Should have to Must have
  • Target version set to Candidate for patchlevel
Actions #4

Updated by Christian Futterlieb over 7 years ago

I have quite the same problem with a select field with a defined set of items (no foreign_table). In my case, the first item is shown as selected value in the localized version (instead of the value of the original). Appears in TYPO3 7.6 and 8.6.1.

'duplicationCheck' => [
    'exclude' => true,
    'label' => 'Duplication test',
    'l10n_mode' => 'exclude',
    'l10n_display' => 'defaultAsReadonly',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectSingle',
        'items' => [
            [
                'Test by IP',
                'ip'
            ],
            [
                'Test by cookie',
                'cookie'
            ],
            [
                'Foo test',
                'foo'
            ],
            [
                'None',
                ''
            ]
        ],
        'default' => 'cookie'
    ]
]

Additionally I recognised, that in TYPO3 7.6 the field value gets copied to the translated record with the configured default value, while in TYPO3 8.6.1 the selected value is used. Don't know whether this is intended or not (or even related to this task), just for you to know :-)

Actions #5

Updated by Christian Kuhn over 7 years ago

  • Parent task set to #69617
Actions #6

Updated by Loon Buster over 7 years ago

..are there any news about this?

.loon

Actions #7

Updated by Michael Stopp over 6 years ago

  • Related to Bug #84997: Localized records with rendertype selectCheckBox + defaultAsReadonly generate PHP warnings added
Actions #8

Updated by Andreas Krämer over 5 years ago

  • Is duplicate of Bug #76785: Wrong Selected option in localised TCA columns of type select when l10n_mode="exclude" added
Actions #9

Updated by Andreas Krämer over 5 years ago

  • Related to Bug #82843: TCA: localized `SelectSingleElement` selects wrong option added
Actions #10

Updated by Thomas Deinhamer over 5 years ago

Just encountered this with TYPO3 8.7.24 - the option in the localized record is not selected correctly; it just uses/shows the default/first option.

Actions #11

Updated by Gerrit Code Review over 4 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/c/Packages/TYPO3.CMS/+/63722

Actions #12

Updated by Benni Mack over 4 years ago

  • Related to Bug #81996: Read ony select field 'renderType' => 'selectSingle' renders all available items added
Actions #13

Updated by Gerrit Code Review over 4 years ago

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

Actions #14

Updated by Benni Mack over 4 years ago

  • Status changed from Under Review to Resolved
Actions #15

Updated by Gerrit Code Review over 4 years ago

  • Status changed from Resolved to Under Review

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

Actions #16

Updated by Benni Mack over 4 years ago

  • Status changed from Under Review to Resolved
Actions #17

Updated by Benni Mack over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF