Welcome Guest, Not a member yet? Register   Sign In
validateData string error message
#1
Bug 
(This post was last modified: 07-29-2024, 11:10 PM by kenjis.)

In the controller, use

PHP Code:
$this->validateData($data'account'  => 'required|string|max_length[64]|min_length[3]'); 
but, account input value is 123, the validate not alert error message.
may i something wrong?!

PHP Version: 8.3.9
CI Version: 4.5.3
Reply
#2

Works. Check https://codeigniter4.github.io/userguide...rict-rules
PHP Code:
        $data = ['account' => 123];
        $this->validateData($data, ['account'  => 'required|string|max_length[64]|min_length[3]']);
        dd($this->validator->getErrors()); 

Code:
array:1 [▼
  "account" => "Поле account должно быть допустимой строкой."
]
Simple CI 4 project for beginners codeigniter-expenses ( topic )
Reply
#3

(07-07-2024, 09:14 PM)yehchge Wrote: In the controller, use

PHP Code:
$this->validateData($data'account'  => 'required|string|max_length[64]|min_length[3]'); 
but, account input value is 123, the validate not alert error message.
may i something wrong?!

PHP Version: 8.3.9
CI Version: 4.5.3

The 'account' => 'required|string|max_length[64]|min_length[3]' should inside an array bracket [].

so, it's like @ozornick php code.  Big Grin

Code:
$this->validateData($data, ['account'  => 'required|string|max_length[64]|min_length[3]']);
Reply




Theme © iAndrew 2016 - Forum software by © MyBB