【发布时间】:2014-06-03 15:28:07
【问题描述】:
我目前正在尝试编写一个简单的输入表单扩展:用户输入输入字段值,提交操作将值插入数据库,然后重定向到外部支付服务。
很遗憾,createAction 函数在单击提交按钮后没有显示任何反应。
出于测试目的,我只想在提交后输出一个文本。但即使这样也行不通。
如果我在 newAction 中使用与 flashMessageContainer 完全相同的功能,它会起作用:消息会立即显示。但是,当我想在单击提交按钮后显示它时,只会发生页面重新加载。
可能是什么问题?
资源/私有/模板/付款/New.html:
<f:form method="post" controller="Payment" action="create" id="newPayment" name="newPayment" object="{newPayment}">
<f:render partial="Payment/FormFields" />
<div class="buttons row">
<div class="col c6">
<f:form.submit value="{f:translate(key:'tx_chilipayment_domain_model_payment.submit')}" />
</div>
</div>
......
类/控制器/PaymentController.php:
<?php
namespace chilischarf\ChiliPayment\Controller;
class PaymentController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
/**
* paymentRepository
*
* @var \chilischarf\ChiliPayment\Domain\Repository\PaymentRepository
* @inject
*/
protected $paymentRepository;
/**
* action new
*
* @param \chilischarf\ChiliPayment\Domain\Model\Payment $newPayment
* @dontvalidate $newPayment
* @return void
*/
public function newAction(\chilischarf\ChiliPayment\Domain\Model\Payment $newPayment = NULL) {
$this -> view -> assign('newPayment', $newPayment);
}
/**
* action create
*
* @param \chilischarf\ChiliPayment\Domain\Model\Payment $newPayment
* @return void
*/
public function createAction(\chilischarf\ChiliPayment\Domain\Model\Payment $newPayment) {
$this -> flashMessageContainer -> add('Your new Payment was created.');
}
}
?>
【问题讨论】:
标签: php forms input typo3 extbase