Feature #54196

IfHasValidationError ViewHelper

Added by Adrian Föder over 1 year ago. Updated over 1 year ago.

Status:Resolved Start date:2013-12-04
Priority:Could have Due date:
Assigned To:Adrian Föder % Done:

100%

Category:ViewHelpers
Target version:-
Has patch:No

Description

to cope with the practice done by common CSS frameworks where a specific form field's parent element must/should have a particular error CSS class, I suggest introducing a ViewHelper which then will be used like

1<div class="row {f:form.ifHasValidationError(property: 'some.emailAddress', then: 'has-error')}"><input...></div>

Associated revisions

Revision c4d4db3a
Added by Adrian Föder over 1 year ago

[FEATURE] Introduce Validation.IfHasErrors ViewHelper

This allows to check whether validation errors adhere
to the current request, or if there is such an error
for a particular property path.

Change-Id: I538cb1d9e25d5525784f26a5ec3346a6eb36751a
Resolves: #54196
Releases: master

Revision 49dfdbe5
Added by Adrian Föder over 1 year ago

[TASK] Move f:form.validationResults view helper to f:validation.results

Moves the validationResults ViewHelper to the ``validation`` namespace
for consistency reasons.
If you use this ViewHelper you should update your Fluid templates from::
<f:form.validationResults>...</f:form.validationResults>
to::
<f:validation.results></f:validation.results>

Change-Id: I94baa5df6c5164368c327e23385afe61e5e689a1
Related: #54196
Releases: master

History

#1 Updated by Adrian Föder over 1 year ago

I come up with a proposal additionally, could this go into a `Validation` sub-namespace like

<f:form.validation.ifHasError property="some.email" />

In the future, the current ValidationResults VH could be moved into that NS, too.

#2 Updated by Bastian Waidelich over 1 year ago

Adrian Föder wrote:

I come up with a proposal additionally, could this go into a `Validation` sub-namespace like
In the future, the current ValidationResults VH could be moved into that NS, too.

I like the idea of moving it, but it should not be in "form" IMO, but:

<f:validation.results />
<f:validation.hasErrors />

BTW: The "property" argument should be optional

#3 Updated by Philipp Maier over 1 year ago

+1 That would even work without breaking anything.

#4 Updated by Adrian Föder over 1 year ago

Bastian good point because when again thinking about it it's not even bound to any form; the stuff is stored in the request, so it's quite correct!

#5 Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.Fluid has been pushed to the review server.
It is available at https://review.typo3.org/25949

#6 Updated by Adrian Föder over 1 year ago

the moved validation.results ViewHelper changeset is here: https://review.typo3.org/#/c/25953/

#7 Updated by Adrian Föder over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF