Created
October 17, 2011 09:59
-
-
Save violetyk/1292318 to your computer and use it in GitHub Desktop.
[cakephp]パスワード確認入力のバリデーション
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class AppModel extends Model { | |
function equaltofield($check,$otherfield) { | |
$fname = ''; | |
foreach ($check as $key => $value){ | |
$fname = $key; | |
break; | |
} | |
return $this->data[$this->name][$otherfield] === $this->data[$this->name][$fname]; | |
} | |
} | |
// 使い方 | |
var $validate = array( | |
// パスワード(確認) | |
'password_confirm' => array( | |
'rule' => array('equaltofield', 'tmp_password'), | |
'message' => '上で入力されたパスワードと違います。', | |
), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment