How to override the form validation messages in symfony2. Though there is a validation.xml file related model classes. I think it validates a form based on html5.
“Please match the requested format”, “Please fill out this field”. Is there any way to override this validation messages.
Please help me in this regard, i am stuck for more than a day, as i am totally new to symfony
Those messages you see are HTML5 validation messages which are created by the browser. If you want to override them you need to add an oninvalid attribute to the input tag associated with that field. You can do this in two ways:
In your controller or form type, add this attribute to the form field:
Or, in your twig template, add this attribute when rendering the form field: