mirror of
https://github.com/alrayyes/wiki.git
synced 2025-07-20 00:03:26 +00:00
Quartz sync: May 6, 2024, 10:40 PM
This commit is contained in:
parent
aee9145691
commit
4ef8371441
635 changed files with 22281 additions and 6 deletions
24
content/20201111105422-symfony_clear_form_errors.md
Normal file
24
content/20201111105422-symfony_clear_form_errors.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
id: 6e924661-5376-459d-9365-0054027c1755
|
||||
title: Symfony Clear Form Errors
|
||||
---
|
||||
|
||||
# Introduction
|
||||
|
||||
Introduced in [Symfony 4.2](20201111101706-symfony_4_2), `clearErrors()`
|
||||
allows us to remove any existing errors in forms. Some user cases:
|
||||
|
||||
- Partial form submissions with AJAX
|
||||
|
||||
# Syntax
|
||||
|
||||
``` php
|
||||
$task ={};
|
||||
$form = $this->createForm(TaskType::class, $task);
|
||||
// ...
|
||||
|
||||
$form->clearErrors();
|
||||
|
||||
// this removes errors from the form and all its children forms
|
||||
$form->clearErrors(true);
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue