public function hasErrorMessages() {
      $messages = $this->getMessages();
      foreach ($messages as $message) {
        if ($message->mt == 'error') {
          return true;
        }
      }
      return false;
    }