I have app/model/user.php
here is the validation in the model
public function validation() {
$this->validation->add(new EmailValidate(array(
'field' => 'email',
'message' => 'Please enter a valid Email address'
)));
}
When I submit the form it display "email is required" instead of "Please enter a valid Email address"
do I miss something?
You have a problem with your code. You are trying to add a new validator to
$this->validation
. Unless you have extended your ownModel
base class it should be:Because the validator was not added the
email is required
message comes from theNOT NULL
constraint on the table.