Skip to content

Commit

Permalink
Merge pull request #7668 from Murl080/4.next-form-geterror
Browse files Browse the repository at this point in the history
[4.next] Added Example for Form getError()
  • Loading branch information
markstory authored Aug 14, 2023
2 parents 97d995e + 63efb47 commit c9f69c5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion en/core-libraries/form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,15 @@ Once a form has been validated you can retrieve the errors from it::
$errors = $form->getErrors();
/* $errors contains
[
'email' => ['A valid email address is required']
'name' => ['length' => 'Name must be at least two characters long'],
'email' => ['format' => 'A valid email address is required'],
]
*/

$error = $form->getError('email');
/* $error contains
[
'format' => 'A valid email address is required',
]
*/

Expand Down

0 comments on commit c9f69c5

Please sign in to comment.