Symfony Form required true

I have form and for field 'firstname' use required true, how override standard message - "please fill out this field" ?

        ->add('firstname', null, array('label' => 'First Name', 'max_length' => 255, 'required' => true))

In my entity field nullable = true. If I want validate entity I know about * @Assert\NotBlank(massage: "custom message"). But I 'required' => true only in form not entity (because need this for some api) And my question how change custom message if I validate field only in form


To create custom symfony validation messages you need to create the validation.yml class inside YourBundle/Resources/Config/validation.yml

Then inside the validation

  1. Set the entity of the form YourBundle\Entity\EntityName
  2. The property on which you want to set the validation properties: target: - NotBlank: { message: "Your custom message here" }

Here is the screenshot of how I have setup my custom validation (ignore the constraint part for now, just check the properties section and how to set custom validation message.)

You might also want to turn off html5 validations by using novalidate while creating a form.

<form id="register-form" name="register-form" action="{{ path('register') }}" method="post" novalidate>

Need Your Help

Can i manage old web role with new azure sdk?

azure azure-configuration

I already have my azure web role running in cloud using azure sdk 1.6. I want to use sdk 1.7 to try new features. If i install sdk 1.6, can i still manage my old web role?

html5 canvas - Update text

javascript html5 canvas

Here's my project: