Introduction
Providing some functions for validation
How to use
You can load Validation
class through Application::getClass
method.
Controller
$validation = $this->getClass('Validation');
// Check Required
$name = 'Field Label';
$id = 'field_name';
$validation->required($id, $this->in($id), array('@required', $name));
// Get Error
$errorMessage = $validation->getErrorMessage();
Methods
- Validation::required
- Check required
- Validation::alphameric
- Check alphanumeric or not
- Validation::numeric
- Check numeric or not
- Validation::date
- Check valid date string
- Validation::email
- Check valid E-mail string
- Validation::tel
- Check valid tel character (+ - 0-9)
- Validation::time
- Check valid time character (: 0-9)
- Validation::url
- Check valid url character
- Validation::zipcode
- Check valid zip code character (for JP only)
- Validation::userId
- Check allowed character for UserID (- _ . 0-9)
- Validation::password
- Check allowed character to Password
- Validation::maxbyte
- Check character byte
- Validation::length
- Check character length
- Validation::maxlength
- Check character less than maximum length
- Validation::minlength
- Check character more than minimum length
- Validation::hankaku
- Check half-width character for Multi byte string language
- Validation::katakana
- Check Katakana chracter for Japanese language
- Validation::setError
- Set Error status
- Validation::setErrorMessage
- Set Error message
- Validation::isError
- Confirm Error status
- Validation::getErrorMessage
- Get Error message