Feature #54196

IfHasValidationError ViewHelper

Added by Adrian Föder over 8 years ago. Updated over 8 years ago.

Status:
Resolved
Priority:
Could have
Assignee:
Category:
ViewHelpers
Target version:
-
Start date:
2013-12-04
Due date:
% Done:

100%

Estimated time:
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

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

Updated by Adrian Föder over 8 years 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 8 years 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 8 years ago

+1 That would even work without breaking anything.

#4

Updated by Adrian Föder over 8 years 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 8 years 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 8 years ago

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

#7

Updated by Adrian Föder over 8 years ago

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

Also available in: Atom PDF