/**
  * @see Form::validate()
  */
 public function validate()
 {
     parent::validate();
     if (empty($this->subject)) {
         throw new UserInputException('subject');
     }
     if (empty($this->text)) {
         throw new UserInputException('text');
     }
     if (StringUtil::length($this->text) > WCF::getUser()->getPermission('user.contest.maxSolutionLength')) {
         throw new UserInputException('text', 'tooLong');
     }
     if (StringUtil::length($this->secretMessage) > WCF::getUser()->getPermission('user.contest.maxSolutionLength')) {
         throw new UserInputException('secretMessage', 'tooLong');
     }
     if ($this->groupID) {
         $this->ownerGroups = ContestUtil::readAvailableGroups();
         // validate group ids
         if (!array_key_exists($this->groupID, $this->ownerGroups)) {
             throw new UserInputException('ownerID');
         }
     }
     if ($this->sponsorID) {
         if (!$this->contest->isOwner() && !ContestCrew::isMember()) {
             throw new UserInputException('ownerID');
         }
         $this->ownerSponsors = array();
         if ($this->contest->isOwner() || ContestCrew::isMember()) {
             foreach ($this->contest->getSponsors() as $sponsor) {
                 $this->ownerSponsors[$sponsor->sponsorID] = $sponsor;
             }
         }
         // validate group ids
         if (!array_key_exists($this->sponsorID, $this->ownerSponsors)) {
             throw new UserInputException('ownerID');
         }
     }
     if (!array_key_exists($this->state, $this->getStates())) {
         throw new UserInputException('state');
     }
 }