Bug #15720
closedFields of type 'select' with maxitems>1 and itemsProcFunc set work only, if items is set also
0%
Description
I consider the following fact confusing, especially, because it's not documented (or I didn't find it in documentation).
The following in TCA works even if nonIDvalues are set by &tx_hgwstaff_processSortings->main. If the items-Part is left out, it won't.
-----------------
"fieldname" => Array (
"config" => Array (
"type" => "select",
'items' => Array (
Array('', 0),
),
"allowNonIdValues" => 1,
"itemsProcFunc" =>"&tx_hgwstaff_processSortings->main",
"maxitems" => 5,
-----------------
It doesn't work if setup is:
-----------------
"fieldname" => Array (
"config" => Array (
"type" => "select",
//Here is no items-Initialization necessary, because it's done by itemsProcFunc
"allowNonIdValues" => 1,
"itemsProcFunc" =>"&tx_hgwstaff_processSortings->main",
"maxitems" => 5,
-----------------
The reason seams to be in class.t3lib_transferdata.php:
[...]
function renderRecord_selectProc($data,$fieldConfig,$TSconfig,$table,$row,$field) {
global $TCA;
// Initialize:
$elements = t3lib_div::trimExplode(',',$data,1); // Current data set.
$dataAcc=array(); // New data set, ready for interface (list of values, rawurlencoded)
// For list selectors (multi-value):
if (intval($fieldConfig['config']['maxitems'])>1) {
// Add regular elements:
if (is_array($fieldConfig['config']['items'])) { //Process of Items is only called, if the array is initialized.
$fieldConfig['config']['items'] = $this->procesItemArray($fieldConfig['config']['items'], $fi foreach($fieldConfig['config']['items'] as $pvpv) {
foreach($elements as $eKey => $value) {
if (!strcmp($value,$pvpv[1])) {
$dataAcc[$eKey]=rawurlencode($pvpv[1]).'|'.rawurlencode($pvpv[0]);
}
}
}
}
[...]
(issue imported from #M2694)
Updated by Karsten Dambekalns over 16 years ago
I too can confirm the issue. But I can also offer a less obstrusive workaround: just set the items to an empty array, this makes it work but doesn't add an empty/additional item to the list.
Updated by Alexander Opitz over 11 years ago
- Status changed from New to Needs Feedback
- Target version deleted (
0) - PHP Version deleted (
4)
The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?
IMHO I didn't had such problems with 4.2/4.3
Updated by Alexander Opitz almost 11 years ago
- Status changed from Needs Feedback to Closed
No feedback for over 90 days.
Updated by Christjan Grabowski over 10 years ago
I have a very similar problem with 6.2.
My conf:
"config" => array ( 'type' => 'select', 'items' => array( ), itemsProcFunc' => 'Tcahelper->getCountriesFromStaticInfoTables', 'foreign_table' => 'static_countries', 'foreign_table_where' => 'ORDER BY static_countries.cn_short_en', 'allowNonIdValues' => TRUE, 'size' => 30, 'autoSizeMax' => 50, 'minitems' => 1, 'maxitems' => 500, )
The "itemsProcFunc" changes the "uid" of static_info_tables to "cn_iso_2" (allowNonIdValues).
The correct "cn_iso_2" will be succesfully saved (comma seperated), but the Selected-Field
is empty again (maybe an error while allowing the values).
The setup works if i set maxitems to "1" (with only a dropdownbox)!