[TYPO3-core] RFC #17388: Bug: TCA type "select", renderMode "tree", maxitems 1 doesn't work

Marco Huber marco.huber at marit.ag
Wed Mar 16 17:00:16 CET 2011

This is a GIT patch request.

Type: Bugfix

Bugtracker references:

Branches: 4.5, Trunk

I want to use the new TCA tree, but when I configure 1 as maxitems I 
can't select a tree node.

This happens, because this.countSelectedNodes in 
t3lib\js\extjs\tree\tree.js is 1 even when I create a new record. And 
this.countSelectedNodes is 1 because $valueArray in 
t3lib\tceforms\class.t3lib_tceforms_tree.php in the function renderField 
always has at least one entry.

$valueArray is created by exploding $PA['itemFormElValue']. In fresh 
records $PA['itemFormElValue'] is 0 and not NULL (or not set) and has no 
other effects. But $valueArray has an entry and that's why 
count($valueArray) is 1 and then this.countSelectedNodes is also 1.

To reproduce this issue you can use this TCA (Thanks to Steffen: 
= 'tree';
$GLOBALS['TCA']['pages']['columns']['fe_group']['config']['maxitems'] = 1;
= array(
      'parentField' => 'subgroup',
      'appearance' => array(
          'expandAll' => TRUE,
          'showHeader' => TRUE,

To fix this issue $PA['itemFormElValue'] should be only exploded if it's 
not 0. Like I wrote before, this is done in 
t3lib\tceforms\class.t3lib_tceforms_tree.php and fixed in the appended 

Fixing this issue causes a little follow up in 
t3lib\js\extjs\tree\tree.js. This is also fixed in the patch.

I hope the patch file's syntax is correct, this is my first git patch ;-)

Kind regards,
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fix_tcatree_maxitem1.patch
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20110316/539eb4e8/attachment.txt>

More information about the TYPO3-team-core mailing list