mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-21 19:16:23 +00:00
502 B
502 B
date | id | title |
---|---|---|
2020-11-11 | 6e924661-5376-459d-9365-0054027c1755 | Symfony Clear Form Errors |
Introduction
Introduced in Symfony 4.2, clearErrors()
allows us to remove any existing errors in forms. Some user cases:
- Partial form submissions with AJAX
Syntax
$task ={};
$form = $this->createForm(TaskType::class, $task);
// ...
$form->clearErrors();
// this removes errors from the form and all its children forms
$form->clearErrors(true);