Bug #15720

Fields of type 'select' with maxitems>1 and itemsProcFunc set work only, if items is set also

Added by Stephan Struckmann over 16 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2006-02-24
Due date:
% Done:

0%

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

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)

#1

Updated by Jeff Segars over 14 years ago

I can confirm this issue.

#2

Updated by Karsten Dambekalns over 14 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.

#3

Updated by Alexander Opitz over 9 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

#4

Updated by Alexander Opitz almost 9 years ago

  • Status changed from Needs Feedback to Closed

No feedback for over 90 days.

#5

Updated by Christjan Grabowski over 8 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)!

Also available in: Atom PDF