---
title: "Fluid FormValidationErrors einem Property zuordnen"
url: "https://www.typo3.net/d/107829-fluid-formvalidationerrors-einem-property-zuordnen"
source: "typo3.net"
tags: ["Extensions","Extbase","Frage"]
created: "2011-10-19"
last_reply: "2011-10-24"
replies: 2
solved: false
page: 1
pages: 1
lang: "de"
---

# Fluid FormValidationErrors einem Property zuordnen

Extensions › Extbase · 2 Antworten · gestartet 2011-10-19

## Eröffnungsbeitrag

**BFSven** · 2011-10-19 · [Beitrag #1](https://www.typo3.net/d/107829-fluid-formvalidationerrors-einem-property-zuordnen/1)

Hallo,

ich habe folgendes Problem. Ich hab ein Formular, dazu ein Model und an jeder Property eine Validation-Annotation. Nun hängt aber eine Property von einer anderen ab, dazu hab ich die Validierung im Controller an die Action geschrieben. Nun will ich aber diese Fehlermeldung an das Property binden. Hat jemand einen Tipp, wie ich das anstelle?

Gruß, Sven

## Antworten

### [#2](https://www.typo3.net/d/107829-fluid-formvalidationerrors-einem-property-zuordnen/2) · xandio · 2011-10-21

Hallo!

Ich binde die Fehler innerhalb der isValid()-Funktion eines Validators folgendermaßen:

```php
$notEmptyValidator = new Tx_Extbase_Validation_Validator_NotEmptyValidator();
			
if (!($notEmptyValidator->isValid($theCart->getFirstName()))) {
$this->errors['firstName'] = new Tx_Extbase_Validation_PropertyError('firstName');
$this->errors['firstName']->addErrors(array(new Tx_Extbase_Validation_Error(Tx_Extbase_Utility_Localization::translate('error.firstName.empty', 'registration'), '1312448731')));
$success = false;
}
```

Vielleicht hilft Dir das weiter.

Viele Grüße,
Xandi

### [#3](https://www.typo3.net/d/107829-fluid-formvalidationerrors-einem-property-zuordnen/3) · BFSven · 2011-10-24

Hey Xandio,

funktioniert super, danke Dir.

Gruß, Sven

---

Quelle: „Fluid FormValidationErrors einem Property zuordnen“, typo3.net, https://www.typo3.net/d/107829-fluid-formvalidationerrors-einem-property-zuordnen
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
