Bug #77257
closedStory #69617: FormEngine bugs
The selection of a selectbox with the l10n_display type of defaultAsReadonly in TCA is wrong for a localized record
0%
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' ) )
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.
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.
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
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 :-)
Updated by Michael Stopp over 6 years ago
- Related to Bug #84997: Localized records with rendertype selectCheckBox + defaultAsReadonly generate PHP warnings added
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
Updated by Andreas Krämer over 5 years ago
- Related to Bug #82843: TCA: localized `SelectSingleElement` selects wrong option added
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.
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
Updated by Benni Mack over 4 years ago
- Related to Bug #81996: Read ony select field 'renderType' => 'selectSingle' renders all available items added
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
Updated by Benni Mack over 4 years ago
- Status changed from Under Review to Resolved
Applied in changeset a8913dbe2fcf9676153d4036acde7df4cd12681b.
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
Updated by Benni Mack over 4 years ago
- Status changed from Under Review to Resolved
Applied in changeset ae8172cef8ed304dea48c2b1facf54a03ec87206.