Actions
Feature #85070
openViewHelper for accessing single validation results
Status:
New
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2018-05-24
Due date:
% Done:
0%
Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:
Description
Somtimes certain single validation errors are needed in any other place than just adding the errorclass to the control itself. E.g. output a validation error as a css class for a not accepted "PrivacyPolicy" checkbox in any other div.
<f:form.validationResults for="newContact.acceptPrivacyPolicy"> <f:if condition="{validationResults.flattenedErrors}"> alert alert-danger </f:if> </f:form.validationResults>
A ViewHelper like the following would be nice:
{f:form.validationResultFor(object: 'newContact', property: 'acceptPrivacyPolicy', output: 'alert alert-danger')}
This might behave like an "if" statement: The value of argument "output" should be returned if there is an validation error for the given "object" and "property". If there is no validation error, nothing should be returned at all. Usage example:
<div class="{f:form.validationResultFor(object: 'newContact', property: 'acceptPrivacyPolicy', output: 'alert alert-danger')}"> <f:form.checkbox property="acceptPrivacyPolicy" /> This is any privacy policy related text... The wrapping div should be highlighted when validation fails for this property. </div>
No data to display
Actions