TYPO3 如何在输出以查看之前获取所有验证错误

编程入门 行业动态 更新时间:2024-10-27 16:24:35
本文介绍了TYPO3 如何在输出以查看之前获取所有验证错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

在 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 如何在输出以查看之前获取所有验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-29 08:47:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1187963.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!