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

  • SEARCH
  • Home
  • 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 8967121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:10:37+00:00 2026-06-15T17:10:37+00:00

For my contact form no form errors are displayed. $contact = new Contact(); $form

  • 0

For my contact form no form errors are displayed.

    $contact = new Contact();

    $form = $this->createForm(new ContactFormType(), $contact);

    /* handle contact form submission */
    if ('POST' == $request->getMethod()) {
        $form->bindRequest($request);

        if ($form->isValid()) {
            //Do something
        }
    }

    return $this->render('MainBundle:Default:contact.html.twig', array(
                'form' => $form->createView()
    ));

My validator

Fc\MainBundle\Entity\Contact:
    properties:
        firstName:
            - NotBlank: ~

        lastName:
            - NotBlank: ~

        email:
            - NotBlank: ~
            - Email:
                checkMX: true
        title:
            - NotBlank: ~
        message:
            - NotBlank: ~

I have added a novalidate attribute to my form tag to check if my validation works. Now when I submit the form with empty data nothing happens (with correct data everything is fine), the controller identifies the form as invalid and stops further processes.

In the template I call

 {{ form_errors(form) }}

But nothing is displayed. Any ideas why? I use symfony 2.1.X

  • 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-15T17:10:39+00:00Added an answer on June 15, 2026 at 5:10 pm

    Can you confirm that the validation is working with this:

    if ($form->isValid()) {
    //Do something
    }
    else
    { die('not valid') }
    

    Is the form well posted?

    Is there anything in the HTML that shows up where you call {{ form_errors(form) }} ? – it would be a CSS or JS problem if that’s the case…

    Have you tried to show the errors by field (there is no global error in your validation apparently):

    {{ form_errors(form.firstName) }}
    etc.
    

    Remark: form.firstName works, not form.first_name. You have to follow that convention with Doctrine2/Symfony2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my contact function : public static function contact_anon() { $form = new
I'm trying to make my contact form submission process work equally well whether the
In Access 2007, I have a form to add a new contact to a
having a problem getting my simple php email contact form working. No errors are
I have a contact form on my website so users can send me an
I'm building a contact form that appears in a jQuery popup box. When you
I'm using Contact Form 7 plugin in a WordPress template. I created the form
I have a contact form made with php on my website. The problem is
I have a contact form which asks users for their name, email address and
I have a contact form in a div on it's own with opacity 0,

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.