Validation::time
Check valid time character (: 0-9)
Description
public boolean Validation::time( string $name, mixed $value, [ mixed $code = '' ] )
Arguments
Name | Data type | Default | Remarks |
---|---|---|---|
$name | string | Item label | |
$value | mixed | Check field value | |
$code | mixed | "" | Error code or Error message |
Example
Controller
$validation = $this->getClass('Validation');
// If $value is Tel string
$successName = 'Success Field';
$successVar = '00:00:00';
$validation->time('success', $successVar, array('@time', $successName));
var_dump($validation->isError()); // -> false
var_dump($validation->getErrorMessage()); // -> null
// If $value is not Tel string
$failedName = 'Failed Field';
$failedVar = '2000/01/01';
$validation->time('failed', $failedVar, array('@time', $failedName));
var_dump($validation->isError()); // -> true
var_dump($validation->getErrorMessage());
// -> "failed" => "<strong>Failed Field</strong> の時間では登録できません"