【问题标题】:Typo3 (7.6.4) Extbase New Action arguments empty after submitTypo3 (7.6.4) Extbase New Action 参数在提交后为空
【发布时间】:2016-04-22 07:14:59
【问题描述】:

如果我提交了我的新操作并且表单无效,那么我将无法获得提交的帖子变量。 $this->request->getArguments() 在我的新操作中为空。

/**
 * action new
 *
 * @param \Vendor\MyExt\Domain\Model\Protokoll $newProtokoll
 * @return void
 */
public function newAction(\Vendor\MyExt\Domain\Model\Protokoll $newProtokoll = null)
{

    $this->view->assign('newProtokoll', $newProtokoll);
    .....
    $arguments = $this->request->getArguments();
    echo "<pre>";
    print_r($arguments);
    echo "</pre>";
    ....

->空的

【问题讨论】:

标签: php typo3 extbase typo3-flow


【解决方案1】:

您应该使用newAction 来显示表单,并使用单独的createAction 来验证数据并输入数据库。如果表单无效,用户将返回到 newAction,其中包含输入数据的 $newProtokoll 对象。

你不应该使用$this-&gt;request-&gt;getArguments(),因为如果你的方法参数中有它,它会自动转换。

在博客示例中对此进行了非常详细的解释: https://docs.typo3.org/typo3cms/ExtbaseFluidBook/3-BlogExample/11-Alternative-route-creating-a-new-posting.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-06-02
    • 2021-11-10
    • 2022-09-28
    • 2012-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多