code: public function formError($field, $message = '')
      {
          $formErrors = &$this->getFormErrors();
          if ($message) {
              if (is_int($message) && isset($this->errorList[$message])) {
                  // Use predefined error
                  $formErrors[$field] = $this->errorList[$message];
              }else{
                  // Use given error message
                  $formErrors[$field] = $message;
              }
              $this->error($message);
          } else {
              // if the message if omitted use the field as a generic message
              $formErrors[$field] = $message;
              $this->error($field);
          }
  
          return $this;
      }
docs: Log an error to a form field error
  Note: Only one error per field in a channel namespace
  
  @param string $field   - The form field name
  @param string|int $message - The error message to link to the field or an ID of a predefined error message
  
  @return $this