简体   繁体   English

如何在Symfony 1.4中禁用表单的postValidator

[英]How to disable form's postValidator in symfony 1.4

I have pre, post and "regular" validators. 我有前置,后置和“常规”验证器。

How can I completely disable postvalidator or check for failure from postvalidator if "regular" validator has already failed? 如果“常规”验证器已经失败,如何完全禁用postvalidator或从postvalidator检查失败?

This isn't possible using some Symfony setting. 使用某些Symfony设置是不可能的。 The sfValidatorSchema checks everything, so all errors are reported to the user. sfValidatorSchema检查所有内容,因此所有错误均报告给用户。 And normally, this is exactly what you want. 通常,这正是您想要的。

So, I don't know what your postvalidator looks like, but if it's custom built, you can probably just check if the value in the $values array is empty. 因此,我不知道您的postvalidator是什么样子,但是如果它是自定义构建的,则可能只需检查$values数组中的$values是否为空。 If so, just return the values without throwing an error. 如果是这样,只需返回值而不会引发错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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