---
title: "flexform, dynamische selectbox und sysfolder"
url: "https://www.typo3.net/d/70195-flexform-dynamische-selectbox-und-sysfolder"
source: "typo3.net"
tags: ["Extensions","Entwicklung","FlexForms","Frage"]
created: "2007-11-07"
last_reply: "2007-12-13"
replies: 1
solved: false
page: 1
pages: 1
lang: "de"
---

# flexform, dynamische selectbox und sysfolder

Extensions › Entwicklung · 1 Antwort · gestartet 2007-11-07

## Eröffnungsbeitrag

**dnalor** · 2007-11-07 · [Beitrag #1](https://www.typo3.net/d/70195-flexform-dynamische-selectbox-und-sysfolder/1)

Hallo Experten,

ich habe mit Flexform eine dynamische Selectbox gebaut. Inhalt der Selectbox sind die Gruppen aus fe_groups. Das funktioniert wunderbar nur brauche ich jetzt eine zusätzliche where-Bedingung in der Abfrage zum Füllen der Selectorbox. Momentan werden alle Gruppen aus fe_groups gelesen. Ich möchte aber nur die Gruppen die im Systemordner gespeichert sind, der als "Allgemeine Datensatzsammlung" auf der Seite meines Plugins definiert wird. Wie komme ich in der Funktion zum Füllen der dyn. Selectorbox an die ID des Systemordner?

Flexform:

```typoscript
   <dynfield>
    <tceforms>
     <label>Profilkategorie</label>
     <config>
       <itemsprocfunc>tx_sytextuserprofiles_addFieldsToFlexForm->addFields</itemsprocfunc>
      <type>select</type>
     </config>
     </tceforms>
  </dynfield>
```

Funktion zum Füllen der Selectorbox:

```php
<?php

class tx_sytextuserprofiles_addFieldsToFlexForm {
 function addFields ($config) {
   $optionList = array();
   
   $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,title', 'fe_groups', 'hidden=0 and deleted=0'/* and pid='.$GLOBALS['TSFE']->getStorageSiterootPids()*/, '','','');

 $i=0;   
   
 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))
  {
   $optionList[$i] = array(0 => $row['title'], 1 => $row['uid']);
   $i++;
  }

   $config['items'] = array_merge($config['items'],$optionList);
   return $config;
 }
}

?>
```

## Antworten

### [#2](https://www.typo3.net/d/70195-flexform-dynamische-selectbox-und-sysfolder/2) · InforMedic · 2007-12-13

Hi,

ich brauch zwar kein extra where, habe aber das problem das mir die selectbox ind er flexform nicht dynamisch gefüllt wird.

Ich habe folgendes in der flex.xml stehen:

```html
          <dbtable>
            <TCEforms>
              <label>LLL:EXT:myext/locallang_tca.php:tx_myext.pi_flexform.dbtable</label>
                <config>
                <type>select</type>
                <itemsprocfunc>EXT:myext/pi2/tx_myext_pi2->addFieldsToFlexForm</itemsprocfunc>
                <maxitems>10</maxitems>
                <size>5</size>
                <multiple>0</multiple>
                <selectedListStyle>width:250px</selectedListStyle>
                <itemListStyle>width:250px</itemListStyle>
                </config>
            </TCEforms>
          </dbtable>
```

Meine pi2.php sieht so aus:

```php
// Declare global constants
define('PATH_t3conf', 'http://'.$_SERVER['SERVER_NAME'].'/testpage/typo3conf/ext/');
require_once(PATH_t3conf.'myext/pi2/class.tx_myext_pi2.php');

/**
 * Plugin 'blablub.
 *
 * @author	Ich
 * @package	TYPO3
 * @subpackage	tx_myext
 */
class tx_myext_pi2 extends tx_myext_pi1 {
	function addFieldsToFlexForm ($config) {
		$optionList = array();
		$TCA = $GLOBALS['TCA'];
		//debug($TCA, "TCA");
		// Load table config array (TCA)
		while(list($table)=each($TCA)) {
			$table = strstr($table, 'tx_');
			if (isset($TCA[$table]['ctrl']['transOrigPointerField'])) {
				t3lib_div::loadTCA($table);
				$optionList[] = $table;
			}
		}
		$config['items'] = array_merge($config['items'],$optionList);
		return $config;
	}
```

Wie sind denn die Pfade bei dir? Wo liegt denn deine php klasse?
Ist meine itemsprocfunc(tion) so richtig?

Gruß
Info

---

Quelle: „flexform, dynamische selectbox und sysfolder“, typo3.net, https://www.typo3.net/d/70195-flexform-dynamische-selectbox-und-sysfolder
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
