/symfony-form-input-validation-exploration

Show custom CSS classes on a form input field when using Symfony / Twig

Primary LanguagePHP

Exploring Twig Extensions

In this short two part tutorial series you will learn how easy it is to extract complex or repeated logic from your Symfony Twig templates, and create Twig Extension functions to keep your templates DRY.

This is one possible solution to a question I was asked:

How can I add a custom CSS class to the input / other form field when validation fails for that field?

If you'd like to see the full tutorial then please visit:

https://codereviewvideos.com/course/member-questions/video/part-1-twig-extensions-how-to-add-a-custom-css-class-to-an-invalid-form-field