Skip to content
Advertisement

How to Add message to the @Assert?

I am trying to customize Symfony validator messages!

JavaScript

The unique entity error message works perfectly fine and shows up like this enter image description here

I tried to add a message to * @AssertNotBlank() for example and do @AssertNotBlank(message="The password can't be blank ") but it shows like this ..

enter image description here

I want the error message to be The password can’t be blank instead of Veuillez compléter ce champ.

Also, I want it to appear like UniqueEntity message! how?

Code of my entity :

JavaScript

Code of View

JavaScript

Advertisement

Answer

Solved thanks to msg comment!

In case anyone faced this error u can use novalidate attribute to disable browser validation!

instead of

JavaScript

use

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement