简体   繁体   中英

Typo3 backend module form error

I have no idea why, but the error just disappear without any changes. Now it works. I have not change anything. (I deleted cache many times so it cannot be because of the cache)

Problem

I created an extension using extension builder (if anyone knows any good documentation please give me link because official documentation does not have any examples). I have a form and when I submit the form I have the error

TYPO3 v4.7

The action "formSave" (controller "Promoters") is not allowed by this plugin. Please check Tx_Extbase_Utility_Extension::configurePlugin() in your ext_localconf.php.

I created ext_localconf.php according to typo's wiki.

Form code

<f:form action="formSave" name="" object="">
  <f:form.textfield id="emailResendInterval" name="emailResendInterval" value="" />
  <f:form.textarea cols="30" rows="5" id="emails" name="emails" value="" />
  <f:form.submit name="submit" value="Save" />
</f:form>

ext_localconf.php

<?php
if (!defined ('TYPO3_MODE')) die ('Access denied.');
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY] = unserialize($_EXTCONF);
if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['registerSinglePlugin']) {
    // fully fletged blog
    Tx_Extbase_Utility_Extension::configurePlugin(
        $_EXTKEY,                                                                   // The extension name (in UpperCamelCase) or the extension key (in lower_underscore)
        'Promoters',                                                                        // A unique name of the plugin in UpperCamelCase
        array (                                                                     // An array holding the controller-action-combinations that are accessible
            'Promoters' => 'configuration,formSave',        // The first controller and its first action will be the default
        ),
        array(                                                                      // An array of non-cachable controller-action-combinations (they must already be enabled)
        )
    );
} else {
    Tx_Extbase_Utility_Extension::configurePlugin(
        $_EXTKEY,                                                                   // The extension name (in UpperCamelCase) or the extension key (in lower_underscore)
        'Promoters',                                                                        // A unique name of the plugin in UpperCamelCase
        array (                                                                     // An array holding the controller-action-combinations that are accessible
            'Promoters' => 'configuration,formSave',        // The first controller and its first action will be the default
        ),
        array(                                                                      // An array of non-cachable controller-action-combinations (they must already be enabled)
        )
    );

PromotersControler

class Tx_Promoters_Controller_PromotersController extends Tx_Extbase_MVC_Controller_ActionController {

    /**
     * action configuration
     *
     * @return void
     */
    public function configurationAction() {

    }

    /**
     * action formSave
     *
     * @return void
     */
    public function formSaveAction() {

    }

}

Seems fine actually, I'm not sure about the if statemant in the localconf though. Please try this:

    <?php
        if (!defined ('TYPO3_MODE')) die ('Access denied.');

            // fully fletged blog
            Tx_Extbase_Utility_Extension::configurePlugin(
                $_EXTKEY,                      
                'Promoters',     
                array (
                    'Promoters' => 'configuration,formSave', 
                ),
                array(                        
                )
            );
    ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM