[TYPO3-dev] TCA and itemsProcFunc... small issue using maxItems SOLVED
Ries van Twisk
typo3 at rvt.dds.nl
Wed Jun 14 21:15:30 CEST 2006
Ries van Twisk wrote:
> Hey All,
>
> I am using the below to fill an array so in my TCA I can retrieve some
> custom values:
>
> function user_GetConstItems(&$config, &$item) {
> $config['items'][] = array( '', '' );
>
> $res = $GLOBALS['TYPO3_DB'] -> exec_SELECTquery( 'I.name as name,
> I.uid as uid', 'tx_ltgdbstructures_const_items AS I,
> tx_ltgdbstructures_const_types AS T', ' LOCATE( I.uid, T.items ) >0 AND
> T.uid = '.$config['config']['constType']);
> while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
> $config['items'][] = array( $row['name'], intval($row['uid']) );
> }
> return $config;
> }
>
> In my config I do then something like this:
> "config" => Array (
> "type" => "select",
> "itemsProcFunc" => 'user_GetConstItems',
> "constType" => 16,
> "size" => 1,
> "minitems" => 0,
> "maxitems" => 15,
> )
>
> This works perfect for drop downs,
> but as soon as I set maxItems to anything above 1 then
> it fails to get any information in my form nor I can set information in
> my form.
>
> Are there any samples or does anybody know an extension that does simular?
> Ofcourse I did RTFM here
> :http://typo3.org/documentation/document-library/core-documentation/doc_core_api/current/view/4/1/
>
> But that doesn;t give ma good clue what formats to use.
>
> Ries
>
>
Hey all,
to answer my own question:
I hadd to create the config like this:
"config" => Array (
"type" => "select",
"items" => Array ( ),
"itemsProcFunc" => 'user_GetConstItems',
"constType" => 16,
"size" => 10,
"minitems" => 0,
"maxitems" => 15,
)
Appart from changed values,
you HAVE to add "items" => Array ( ),
Otherwise setting maxitems to any value above 1 doesn't work
Ries
>
>
>
--
Ries van Twisk
Freelance Typo3 Developer
=== Private:
email: ries at vantwisk.nl
web: http://www.rvantwisk.nl/freelance-typo3.html
skype: callto://r.vantwisk
=== Work:
email: ries at livetravelguides.com
web: http://www.livetravelguides.com
More information about the TYPO3-dev
mailing list