Symfony Clear Form Errors

Introduction

Introduced in [Symfony 4.2](Symfony 4.2), clearErrors() allows us to remove any existing errors in forms. Some user cases:

  • Partial form submissions with AJAX

Syntax

form = task);
// …

$form->clearErrors();

// this removes errors from the form and all its children forms
$form->clearErrors(true);