[TYPO3-english] Flexform questions

Robert Wildling robertwildling at gmail.com
Tue May 8 23:56:45 CEST 2012

Thank you so much for responding, Jigal!

I do have a script, but the return values are wrong - and I don't why. 
The debug statements through the correct contents, but obviousely I am 
putting them together in a wrong way... the multiselect result list is 
filled with these 3 values:

Please choose...

I Have absolutely no idea where the 2 "A"s come from...???

This is the script - maybe you find a moment ... thanks!

class tx_rwhandselectedcontent_addFieldsToFlexForm
   function addFields ($config)
	// fetch values from FlexForm
       	$piValues  = t3lib_div::xml2array($config['row']['pi_flexform']);
       	// extract the reqired data into 2 variables
       	$teaserPID = $piValues['data']['sDEF']['lDEF']['teaserPID']['vDEF'];
       	$col 	   = $piValues['data']['sDEF']['lDEF']['col']['vDEF'];
       	//debug($piValues,'FELXFORM-VALUES',__LINE__, __FILE__,5);
       	//debug($teaserPID,'TEASER-PID',__LINE__, __FILE__,5);
         //debug($col,'COL-NR',__LINE__, __FILE__,5);
       	// Prepare SQL Statement to get all child pages of current page 
       	$queryParts['SELECT'] = '*';
       	$queryParts['FROM'] = 'tt_content';
       	$queryParts['WHERE'] = "pid=" . $teaserPID . ' AND colPos=' . $col;
       	$queryParts['GROUPBY'] = '';
       	$queryParts['SORTING'] = 'crdate';
       	$queryParts['LIMIT'] = '';
       	$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
       	//$num = $GLOBALS['TYPO3_DB']->sql_num_rows($res);

       	$optionList = array();
       	$optionList[0] = array("Please choose...",0);
       	while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
       		//$header = $row['header'];
       		//$index = $row['uid'];
		//   -> debug shows correct values
       		//$optionList[$i] .= array($header, $index);
       		$optionList[$i] .= array(0=>$row['header'], 1=>$row['uid']); // 
<-- here sth is wrong!!!

       		$optionList[$i] .= array(0=>"$row['header']", 
1=>"$row['uid']"); // <-- doesn't work either ...



       	$config['items'] = array_merge($config['items'],$optionList);
__FILE__,5); // <- throws NULL
       	//debug($config['items'],'configItems',__LINE__, __FILE__,5);
	return $config;

>>> The next step would be to show a field that reads the contents from the
>>> table with the pid given in teaserPID in form of a database relation (an
>>> empty select box next to a selectbox with a list of content elements to
>>> choose from). Here I am totally stuck. The only entry in the Core
>>> documentation that can be found when searching for database relation is
>>> under allowNonIdValues ...
> I think there is enough information in the thread you linked in one of
> your answers to the original question. You can populate the field with a
> custom function using <itemsProcFunc> and retrieve the value of your
> teaserPID using the code in François's answer.

More information about the TYPO3-english mailing list