Welcome Guest, Not a member yet? Register   Sign In
Custom validation message not firing
#1

(This post was last modified: 01-31-2021, 05:05 PM by iampuping.)

I am sure it is something simple, but my matches[] validation message is showing the default message instead of my custom one. 

In my controller:
PHP Code:
$validation->withRequest($this->request)->run($_POST'update_password'

In config/validation

   
PHP Code:
public $update_password = [
    'password'          => 'required|min_length[10]',
    'password_again'    => 'matches[password]'
];

public 
$update_password_errors = [
    'password' => [
        'required'    => 'Passwords must be at least 10 characters',
        'min_length'  => 'Passwords must be at least 10 characters'
    ],
    'password_again' => [
        'matches[password]' => 'Your passwords do not match'
    ]
]; 


The error I get when the passwords don't match is:

"The password_again field does not match the password field."

instead of "Your passwords do not match"

Did I typo something?

My form fields are password and password_again.
 
Reply
#2

Rename the key matches[password] to matches
Reply




Theme © iAndrew 2016 - Forum software by © MyBB