Validation API reference
Vtiful\Kernel\Validation builds a single data-validation rule. Every method except __construct() and toResource() returns $this, so calls can be chained.
Class constants
Validation types — TYPE_*
TYPE_INTEGER TYPE_INTEGER_FORMULA
TYPE_DECIMAL TYPE_DECIMAL_FORMULA
TYPE_LIST TYPE_LIST_FORMULA
TYPE_DATE TYPE_DATE_FORMULA TYPE_DATE_NUMBER
TYPE_TIME TYPE_TIME_FORMULA TYPE_TIME_NUMBER
TYPE_LENGTH TYPE_LENGTH_FORMULA
TYPE_CUSTOM_FORMULA
TYPE_ANYCriteria — CRITERIA_*
CRITERIA_BETWEEN CRITERIA_NOT_BETWEEN
CRITERIA_EQUAL_TO CRITERIA_NOT_EQUAL_TO
CRITERIA_GREATER_THAN CRITERIA_LESS_THAN
CRITERIA_GREATER_THAN_OR_EQUAL_TO
CRITERIA_LESS_THAN_OR_EQUAL_TOError severity — ERROR_TYPE_*
Function prototypes
int $type
Validation type — one of the
Validation::TYPE_*constants.
int $criteria
Criteria — one of the
Validation::CRITERIA_*constants.CRITERIA_BETWEENandCRITERIA_NOT_BETWEENrequire bothminimum*andmaximum*to be set; the other comparison criteria usevalue*.
bool $ignore
Whether blank cells are accepted. Defaults to
true.
bool $show
Whether the input prompt (
showInput) or error alert (showError) is displayed when the cell is selected or invalid. Defaults totrue.
bool $on
Whether to show the in-cell drop-down arrow. Defaults to
true. Only meaningful forTYPE_LIST/TYPE_LIST_FORMULA.
float $value
Target value for comparison criteria, e.g.
valueNumber(20)compares against 20.
string $formula
Express the bound as an Excel formula, e.g.
valueFormula('=A1'),minimumFormula('=$A$1').
array $values
List of strings used for
TYPE_LIST. Each element must be a non-empty string, otherwiseVtiful\Exceptionis thrown.
int $timestamp
Unix timestamp; the extension converts it to an Excel serial date.
string $title / $message
Title and body for the input prompt and error alert.
toResource()
Convert the current
Validationbuilder into a resource handle thatExcel::validation()accepts.
Example
Last updated