_errors[] = array($field, $rule, $value); } /** * Indicates whether the error is a detailed pre-validation error * or a FileMaker Web Publishing Engine error. * * @return boolean TRUE, to indicate that this is a pre-validation * error object. */ function isValidationError() { return true; } /** * Returns the number of pre-validation rules that failed. * * @return integer Number of failures. */ function numErrors() { return count($this->_errors); } /** * Returns an array of arrays describing the pre-validation errors that * occurred. * * Each entry in the outer array represents a pre-validation failure. * Each failure is represented by a three-element array with the * following members: * * - 0 => The field object for the field that failed pre-validation. * - 1 => The pre-validation rule that failed specified as a * FILEMAKER_RULE_* constant. * - 2 => The value entered for the field that failed pre-validation. * * Multiple pre-validation rules can fail on a single field. If you set the * optional $fieldName parameter, then failures for only the specified * field are returned. * * @param string $fieldName Name of the field to get errors for. * * @return array Pre-validation error details. */ function getErrors($fieldName = null) { if ($fieldName === null) { return $this->_errors; } $errors = array(); foreach ($this->_errors as $error) { if ($error[0]->getName() == $fieldName) { $errors[] = $error; } } return $errors; } }