| 1 | <?php |
||
| 10 | class ExampleMessageForm extends Form { |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @return bool |
||
| 14 | */ |
||
| 15 | public function isValid() { |
||
| 16 | if (!parent::isValid()) { |
||
| 17 | return false; |
||
| 18 | } |
||
| 19 | |||
| 20 | if ( |
||
| 21 | $this->getElements()['emailFrom']->getValue() == '[email protected]' |
||
| 22 | and $this->getElements()['emailTo']->getValue() == '[email protected]' |
||
| 23 | and $this->getElements()['message']->getValue() == 'copy message text' |
||
| 24 | ) { |
||
| 25 | $this->validationResult = false; |
||
| 26 | $this->addError('message duplicate error'); |
||
| 27 | } |
||
| 28 | |||
| 29 | return $this->validationResult; |
||
| 30 | } |
||
| 31 | |||
| 32 | } |