TheFlame TheFlame - 1 year ago 303
jQuery Question

TYPO3 Flexform Settings not available during Ajax call

For my TYPO3 Extbase Extension I want to do some kind of pagination. The ajax call and everything else is fine so far. But when I try to access the

Array during the ajax call, where the flexform frontend plugin values are stored, I always get
. The part looks like this:

$limit = $this->settings['result']['amount'];
$orderType = $this->settings['order']['type'];
$orderFields = $this->settings['additionorder']['fields'];

$formArr = array();
$this->request->hasArgument('offset') ? $offset = $this->request->getArgument('offset') : null;
$forms = $this->formRepository->findFormsChunked(
$orderFields, $orderType, $limit, $offset

foreach ($forms as $key => $form) {
$formArr[] = array(
'formUid' => $form->getUid(),
'formName' => $form->getName(),
'formFile' => $form->getFile()->getOriginalResource()->getPublicUrl(),
'formType' => $form->getFormtype()->getUid()
return json_encode($formArr);

And $this->settings is null during my ajax call, but I can't imagine why. Are the values only available during the rendering process, which is not happening during the ajax call?

Thanks for the help.


As far as I know, the flexform values are only passed to the selected controller-actions (i.e. displaycond) like this:


and in the select menu:

<numIndex index="1">
<numIndex index="0">LLL:EXT:ext_formpool/Resources/Private/Language/locallang.xlf:name</numIndex>
<numIndex index="1">Controller->normal;Controller->ajax</numIndex>

So the values should be passed to the ajaxAction too? At the moment they are not available...


Unfortunately, it simply doesn't work if you do ajax calls with a separate page type. The flexform is stored in the database and gets only parsed during the framework-loading process. You can check this by including the configuration manager and try to parse the content object's "pi_flexform" field. Or you inject the flexformservice, which is also not loaded during the ajax call. You have to use the eID-mechanism to achieve this.

Answer Source

why not, instead of render your plugin as a content object, directly address it in your ajax call?

plugin_yourext_ajax = PAGE
plugin_yourext_ajax {
    typeNum = 2000

    config {
        disableAllHeaderCode = 1
        xhtml_cleaning = 1
        admPanel = 0
        additionalHeaders = Content-type: text/plain
        no_cache = 1

    10 = USER
    10 {
        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
        pluginName = YourPLugin
        extensionName = YourExt
        controller = ControllerName
        vendorName = Vendor
        action = ajax

        switchableControllerActions {
            YourPlugin {
                1 = ajax

        persistence =< plugin.tx_your_ext.persistence
        view =< plugin.tx_your_ext.view
        update =< plugin.tx_your_ext.update
        settings < plugin.tx_your_ext.settings

This will bootstrap your extension on every call, instead of pagerendering

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download