function beforeValidate(){
$error_messages = array(
- 'notempty' => __('Please be sure to input.'),
- 'between' => __('Between %2$d and %3$d characters.',true),
+ 'notEmpty' => __('Please be sure to input.', true),
+ 'between' => __('Between %2$d and %3$d characters.', true),
+ 'alphaNumeric' => __('Please input only alphameric characters.',true),
);
$this->setErrorMessageI18n($error_messages, false);
$this->replaceValidationErrorMessagesI18n();
return true;
}
+
+ /* 本線alphaNumeric()の上書き */
+ function alphaNumeric($data) {
+ $check = is_array($data) ? array_shift($data) : $data;
+ if (preg_match('/^[0-9a-z]+$/i',$check)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
}
var $validate = array(
'username' => array(
- 'notempty' => array(
+ 'alphaNumeric' => array(
+ 'rule' => 'alphaNumeric',
+ ),
+ 'notEmpty' => array(
'rule' => 'notEmpty',
),
),
'password1' => array(
- 'notempty' => array(
+ 'alphaNumeric' => array(
+ 'rule' => 'alphaNumeric',
+ ),
+ 'notEmpty' => array(
'rule' => 'notEmpty',
),
),
'password2' => array(
- 'notempty' => array(
+ 'alphaNumeric' => array(
+ 'rule' => 'alphaNumeric',
+ ),
+ 'notEmpty' => array(
'rule' => 'notEmpty',
),
)