本文介绍了TYPO3 如何在输出以查看之前获取所有验证错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 TYPO3 自己的表单输入扩展验证是在控制移交给 controller 操作之前完成的.在移交给 view 之前,如何处理验证错误?

In TYPO3 own extension validation of form inputs is done before control is handed over to the controller action. How can I get to work on the validation errors before being handed over to view?

推荐答案

通常没有理由这样做.但是,您可以做的是覆盖控制器中的 errorAction() 方法(从 AbstractActionController 继承).在那里,您可以获得如下所示的验证结果:

Usually there should be no reason to do this. However, what you could do is to override the errorAction() method (which is inherited from AbstractActionController) in your controller. There, you can get the validationResults like this:

$validationResults = $this->arguments->getValidationResults() 

然后你可以在它们绑定到当前请求对象之前摆弄它们:

Then you can fiddle with them before they are bound to the current request object:

    $originalRequest = clone $this->request;
    $this->request->setOriginalRequest($originalRequest);
    $this->request->setOriginalRequestMappingResults($validationResults);

这篇关于TYPO3 如何在输出以查看之前获取所有验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 11:27