I add

public function validateForm(array &$form, FormStateInterface $form_state) {

to MymoduleMyentityForm.php which starts with

namespace Drupal\association\Form;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Form\FormStateInterface;

Then I run the form and when I submit it, I get this error: Uncaught PHP Exception Drupal\Core\Entity\EntityStorageException: "Entity validation was skipped." at /Applications/MAMP/htdocs/JdP8/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php line 770

Any idea why? What am I doing wrong?

1 Answer 1


Documentation of ContentEntityForm::validateForm:

Button-level validation handlers are highly discouraged for entity forms, as they will prevent entity validation from running. If the entity is going to be saved during the form submission, this method should be manually invoked from the button-level validation handler, otherwise an exception will be thrown.

Even if you don't use button-level validation this should be the cause for the exception. Did you call the parent method?

parent::validateForm($form, $form_state);

If you don't run the entity field validation in some way the exception is thrown.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.