[TYPO3-dev] FlexForm Help

Francois Suter fsuter at cobweb.ch
Wed Feb 20 20:55:48 CET 2008


Hi,

> So has no one else had a need to do something like this? Is there no method in flexform to allow this?
> Where would I look to extend the flexform to make this happen?
>  
> I have a simple flexform with two fields. The first one is dynamic, and is populated by an external function. Upon change the form is reloaded. The second is also dynamic, but is based on the value of the first field. How do I achieve that?

I didn't pay attention to that thread before. Yes, it is possible.

In the functions to populate your fields you receive a variable called 
$config. Inside this variable is the value of the flexform in 
$config['row']['pi_flexform'] (note that this assume that we are talking 
about a plugin and that you are using the standard pi_flexform for 
storing your data; if that is not the case, change the name of the field 
accordinngly).

You can then retrieve the content of the flexform as follows:

$flexFormContent = t3lib_div::xml2array($config['row']['pi_flexform']);

and then extract the value of your first field:

$value = $flexFormContent['data']['sDEF']['lDEF']['dynField1']['vDEF'];

HTH

-- 

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch




More information about the TYPO3-dev mailing list