There is a partial Address/FormFields.html
in one of our projects in which I would like to add class="error"
to invalid argument properties’ <label>
elements:
<label for="street" class="{f:validation.ifHasErrors(for: 'person.address.street', then: 'error')}">Street</label>
As far as I can see I have to use the full property’s path (person.address.street
) in the for
attribute of this viewhelper.
As Address
(and the above mentioned partial) is used for various objects (Person, Organisation, Shop, etc.) the names of the submitted request arguments differ: person
, organisation
, shop
, etc. Therefore person.adress.street
does only work if the request argument is person
.
Is it possible to use the validation.ifHasError
viewhelper in a generic way so that it does not matter what the name of the argument is? If not, how would you work around this limitation?