Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8481291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:31:36+00:00 2026-06-10T19:31:36+00:00

How to override the form validation messages in symfony2. Though there is a validation.xml

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:31:38+00:00Added an answer on June 10, 2026 at 7:31 pm

    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:

    $builder->add('email', 'email',array(
        'attr'=>array('oninvalid'=>"setCustomValidity('Would you please enter a valid email?')")
    ));
    

    Or, in your twig template, add this attribute when rendering the form field:

    {{ form_row(form.email, { 'attr': {'oninvalid': "setCustomValidity('Please give me a nice email')"} }) }}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to override the validation_errors() method of the form helper in CodeIgniter for
I'm attempting to override Form.Text in order to modify the Title prior to appearing
I override ProcessCmdKey() in my MDI parent form class and have some keyboard shortcut
In Django admin I want to override and implement my own form for a
I'm using the sfGuardDoctrine plugin, and I would like to customize the form validation
I am using the jQuery validation plugin on my form. I set the basic
I followed the excellent post by Nadia here jQuery override default validation error message
I am using the jquery form validation plugin to validate a long form. If
As part of a form validation in Django, I want to check when a
I create form and controller this form have some validation constrains using Hibernate validator.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.