Normally, we can have the Symfony Form to output the field errors using the form_errors twig function, but how can we get the specific errors of an individual field, but not display it? Or is there any way that we can examine if one field has errors or not?
You're looking for form.fieldname.vars.errors
. If you want to check if a form field has errors or not, use the length
filter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With