Hi,
I just want to make sure that I understood your question
correctly:
In the Content Body you are able to use PHP to set the content
programmatically and e.g. access SoPHIE variables. In the Form
Config you would like to do the same with the Field Options.
This is possible, but in a less obvious way. It is not possible to
write PHP code directly in the Options textarea, but you can set
the options on "runtime initialization": On the corresponding tab
you will find a script field in which you can set PHP code to be
executed just when the form is rendered for each participant. In
this script you can access the step api with which you can set the
attributes on runtime.
The simplies way is to browse the "Set Runtime Attribute" menu and
insert the example code for the field you wish to set. For example
to set the "Options" field (your question), you use:
$stepApi->setRuntimeAttribute('formOptionsJson', 'attribute
value');
As it happens, this special case is a special case:
The (internal) options data must be set in the JSON notation. You
can create a JSON string form any object or PHP (associative)
array using the function json_encode. A short example would look
like this:
$options = array(
'valueA' => 'Displayed label for the first option
(A)',
'valueB' => 'The other option',
);
$optionsJson = json_encode($options);
$stepApi->setRuntimeAttribute('formOptionsJson', $optionsJson);
Of course, this example is a little bit boring, because there is
no actual dynamic in the options, but it should give you the
general idea.
Hope this helps. Please ask if you've got more questions!
Regards,
Philipp
--
Philipp Mamat
Symbic GmbH
Persönlicher Kontakt
Telefon: +49 (0) 541 / 50 79 97-18 | Telefax: -19
Mobil: +49 (0) 176 / 800 144 65 | Mail: philip...@symbic.de
___________________________________________________________
Symbic GmbH | www.symbic.de
Im ICO | Albert-Einstein-Str. 1 | DE-49076 Osnabrück
Sitz der Gesellschaft: Marktstr. 14 | DE-38315 Hornburg
USt.-IdNr.: DE269573411
Eingetragen im Amtsgericht Braunschweig: HRB 202239
Geschäftsführer: Achim Hendriks, Philipp Mamat