<?php
// サーバ側でチェックするルール
function setServerRule() {
$this->_form->addRule('name', '入力してください', 'required');
$this->_form->addRule('mail', '入力してください', 'required');
$this->_form->addRule('mail', '入力内容が不正です', 'email');
$this->_form->addRule(array('passwd', 'pass2'),
'パスワードが一致していません', 'compare');
$this->_form->addRule(array('b_year', 'b_month', 'b_day'),
'日付エラー', 'date_check');
$this->_form->addRule(array('b_hour', 'b_minute'),
'時間エラー', 'time_check');
$this->_form->addRule('zip',
'7桁で入力してください', 'maxlength', 7);
$this->_form->addRule('point',
'半角数字で入力してください', 'numeric');
}
// クライアント側でチェックするルール
function setClientRule() {
// 必須入力項目が入力されていない時のエラーメッセージ表示
$this->_form->setJsWarnings('下記の項目が不正です。','');
$this->_form->addRule('name',
'名前を入力して下さい。', 'required', '', 'client');
$this->_form->addRule(array('passwd', 'pass2'),
'パスワードが一致していません', 'compare', '', 'client');
$this->_form->addRule('point',
'半角数字で入力して下さい。', 'numeric', '', 'client');
$this->_form->addRule('zip',
'7桁で入力して下さい。', 'maxlength', 7, 'client');
}
?>
|