A
A
Alexey Anisimov2016-03-25 14:14:20
symfony
Alexey Anisimov, 2016-03-25 14:14:20

How to fix Symfony 3 form validation error?

Good afternoon.
The problem is the following: On a site written using the Symfony 3 framework, when editing a news item, it throws a validation error for all fields that did not change during editing.
Scenario:

  1. Opened the page for adding news.
  2. Fill in the "Title" and "Text" fields.
  3. Pressed the "submit" button. The news has been successfully created.
  4. Opened the news editing page.
  5. Changed the "Text" field.
  6. Pressed the "submit" button. The validation message "The title field cannot be empty" flies out, but the text is already there.

Validation is written in the validation.yml file
AppBundle\Entity\News:
    properties:
        title:
            - NotBlank:
                message: Поле не может быть пустым
        text:
            - NotBlank:
                message: Поле не может быть пустым

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question