The docs say that 'notBlank'
is a validation rule for fields that you want to make sure they are not empty, as in !empty($somevalue)
, but when I leave the field blank ('') or when I put a value in the field ('s0meCraZyPasSworD')
it still display the error message?
Can anyone see what I'm doing wrong? The rest of the validations work like minlength, but I commented them out to get a better idea of why 'notBlank'
doesn't appear to be working...
CONTROLLER:
// Set of validation rules to be run
$validateRules = [
'fieldList' => [
'currentpassword',
'newpassword',
'confirmpassword'
]
];
if ($this->Admin->validates( $validateRules )) {
...
}
MODEL:
class Admin extends AppModel
{
public $name = 'Admin';
public $validate = [
'currentpassword' => [
'notBlank' => [
'rule' => 'notBlank',
'message' => 'Current password is required.'
]
],
...