开发者

Symfony: any way to show the global errors only if there isn't any field error?

开发者 https://www.devze.com 2022-12-25 10:15 出处:网络
in a form if there is a field and a global error both messages are showed. I would like to show the global errors only if th开发者_StackOverflow社区ere isn\'t any field error.

in a form if there is a field and a global error both messages are showed.

I would like to show the global errors only if th开发者_StackOverflow社区ere isn't any field error.

Any idea?

Javi


This snippet should do the job

<?php if (0 == ( count($form->getErrorSchema()->getErrors()) - count($form->getErrorSchema()->getGlobalErrors()) ) ):?>
<?php echo $form->renderGlobalErrors()?>
<?php endif?>
0

精彩评论

暂无评论...
验证码 换一张
取 消