Documentation · ViewHelper reference

Form / ValidationResultsViewHelper


Validation results view helper

Examples

Output error messages as a list

<f:form.validationResults>
  <f:if condition="{validationResults.flattenedErrors}">
    
    <f:for each="{validationResults.flattenedErrors}" as="errors" key="propertyPath">
  • {propertyPath}
      <f:for each="{errors}" as="error">
    • {error.code}: {error}
    • </f:for>
  • </f:for>
</f:if> </f:form.validationResults>

Output

  • 1234567890: Validation errors for argument "newBlog"

Output error messages for a single property

<f:form.validationResults for="someProperty">
  <f:if condition="{validationResults.flattenedErrors}">
    
    <f:for each="{validationResults.errors}" as="error">
  • {error.code}: {error}
  • </f:for>
</f:if> </f:form.validationResults>

Output

  • 1234567890: Some error message

  • Tag usage example

    <f:form.validationResults for="''" as="'validationResults'">
    	<!-- tag content - may be ignored! -->
    </f:form.validationResults>
  • Inline usage example

    {f:form.validationResults(for: '''', as: ''validationResults'')}

Arguments

Argument Description Type
as

The name of the variable to store the current error

string
for

The name of the error name (e.g. argument name or property name). This can also be a property path (like blog.title), and will then only display the validation errors of that property.

string
Required attribute

Revision history

commit 8c22e535295dbc1f7980a67bbb84ce06f3b7c7be
Author: Sebastian Kurfuerst <*****@typo3.org>
Date:   Wed Jun 22 15:47:39 2011 +0200

    [+FEATURE] (ViewHelpers): Adjust Fluid to new Property Mapper
    
    make sure to merge the relevant Extbase changes as well when testing.
    
    Related: #27656
    Change-Id: Iba7f9559440445d4439a5d2964fa1b3daac7d5bc

commit fd09d197fa8886b97cb20aa9573f39cd08ce989e
Author: Bastian Waidelich <*****@typo3.org>
Date:   Thu Nov 10 18:27:58 2011 +0100

    [TASK] S*****@author annotations
    
    This backports three recent changes of the TYPO3.Fluid package:
    - R*****@license annotation from files (290f4f5)
    - Simplify license header in PHP files (14bacba)
    - D*****@author tags from source code (9c2e837)
    
    This should not contain any functional change!
    
    Change-Id: I9376dca4af78c4f0f82413011d115b8ad04634dd

commit ec3891d8d4e339d8319428211207e6201be9fd73
Author: Thomas Maroschik <*****@dfau.de>
Date:   Wed Oct 17 21:18:26 2012 +0200

    [TASK][WIP] Move non class code back to source files
    
    Change-Id: I620d2e61860142cdc89cc83474c95542799961c0

commit 554e8f890dcc0dd86a27518b58e2b54be26fd37e
Author: Thomas Maroschik <*****@dfau.de>
Date:   Wed Oct 17 22:20:17 2012 +0200

    [TASK] Namespace classes
    
    Change-Id: Ia7432e1c923826ed58206bca15fb94509adbd508

commit 9d13dedf017b614b834261b1bf5d4acb2201f1d4
Author: Alexander Schnitzler <*****@typovision.de>
Date:   Fri Nov 16 19:49:02 2012 +0100

    [CLEANUP] Replace FLOW3 with TYPO3 Flow
    
    Releases: 6.0
    Fixes: #43036
    Change-Id: I62df23587301b4cde3ddeae3686b34f54fe1182e
    Reviewed-on: http://review.typo3.org/16498
    Reviewed-by: Alexander Schnitzler
    Tested-by: Alexander Schnitzler

commit 9d46e6932d35c79bf87c96fa38b8e537c4192f23
Author: Alexander Schnitzler <*****@typovision.de>
Date:   Tue Nov 20 16:27:02 2012 +0100

    [CLEANUP] Adjust code to CGL and fix small namespace bugs
    
    * whitespaces, tabs and blank line issues
    * bool -> boolean
    * int -> integer
    * fix wrong namespace annotations
    
    Fixes: #43157
    Releases: 6.0
    Change-Id: I8397948e19248db029d8efd1555ee56e4982742d
    Reviewed-on: http://review.typo3.org/16619
    Reviewed-by: Helmut Hummel
    Tested-by: Helmut Hummel

commit 920b01d70abfb451dab6dd18b33dd77c3c2aa61b
Author: Wouter Wolters <*****@wouterwolters.nl>
Date:   Wed Mar 6 11:34:50 2013 +0100

    [TASK] Update examples in ValidationResults ViewHelper
    
    The examples in the docblock comment in
    \TYPO3\CMS\Fluid\ViewHelpers\Form\ValidationResultsViewHelper
    need to be updated to match this ViewHelper.
    
    Change-Id: I133faa0ed76f52bd7c534da241da016dfb0be1f5
    Resolves: #40813
    Releases: 6.1, 6.0, 4.7
    Reviewed-on: https://review.typo3.org/18581
    Reviewed-by: Anja Leichsenring
    Tested-by: Anja Leichsenring
    Reviewed-by: Marc Bastian Heinrichs
    Tested-by: Marc Bastian Heinrichs

commit 66fb0ad5c6755089db014cd329357898632bf444
Author: Alexander Schnitzler <*****@typovision.de>
Date:   Sun Jun 2 14:01:17 2013 +0200

    [!!!][FEATURE] Backport recursive and allowing empty validation from Flow
    
    This change enables recursive validation by backporting the TYPO3.Flow
    validation API. Also the validators allow empty values now.
    
    This is a breaking change if you expected the previous behavior. In order
    to make a property required you now need to add the NotEmptyValidator
    explicitly!
    
    This change also changes the validators required return type for the
    default property mapper before 6.1. Before this change the isValid method
    had to return a boolean value. Now this is not necessary anymore, because
    only the errors added by the validator are checked.
    
    Releases: 6.2
    Resolves: #6893
    Resolves: #34838
    Change-Id: I9622a5c3a09689a7db6e80df361b8f6fec671c83
    Reviewed-on: https://review.typo3.org/21428
    Reviewed-by: Marc Bastian Heinrichs
    Tested-by: Marc Bastian Heinrichs
    Reviewed-by: Markus Günther
    Tested-by: Markus Günther
    Reviewed-by: Anja Leichsenring
    Tested-by: Anja Leichsenring

commit 77f29a3c69a7cbb27b34072754aa503bace6c9f1
Author: Christian Kuhn <*****@schwarzbu.ch>
Date:   Tue Oct 1 14:40:56 2013 +0200

    [TASK] Remove closing PHP tags
    
    Change-Id: Iaa92566c53301e49396fc9fb26b0b339c48d567b
    Resolves: #52360
    Releases: 6.2
    Reviewed-on: https://review.typo3.org/24212
    Reviewed-by: Christian Kuhn
    Tested-by: Christian Kuhn
    Reviewed-by: Ernesto Baschny
    Tested-by: Ernesto Baschny
    Reviewed-by: Anja Leichsenring
    Tested-by: Anja Leichsenring