validate form CI4 |
helper(['form', 'url']);
if (! $this->validate([])) { echo view('Signup', [ 'validation' => $this->validation ]); } else { echo view('Success'); } is a exceptionHandler
What message is the Exception saying?
"Argument 1 passed to helper() must be of the type string, array given, called in C:\xampp\htdocs\ci4m_framework\application\Controllers\Login.php on line 10"
line 10 -> helper(['form', 'url']); my source: public function index() { //echo view('w_login'); $validation = \Config\Services::validation(); helper(['form', 'url']); //library(['validation']); // // // // // // // $validation->setRules([ // 'id' => 'required', // 'pw' => 'required|min_length[10]' //]); // if (! $this->validate([])) { echo view('w_login', [ 'validation' => $this->validation ]); } else { echo view('w_login'); } }
modified helper(['form', 'url']); in helper('form', 'url');
in line if (! $this->validate([])) exception "Call to undefined method Login::validate()" Quote:"Argument 1 passed to helper() must be of the type string, array given, called in C:\xampp\htdocs\ci4m_framework\application\Controllers\Login.php on line 10" It tells you exactly what the error is there. The `helper()` method doesn't currently allow more than one helper to be loaded at a time. Hence, it requires a string, not an array. It probably should, and I'll make an issue to that affect to remind me, but doesn't currently. In your case, it's not biggie - the url helper is loaded by default.
it works fine.
@Lonnie You already did it (https://github.com/bcit-ci/CodeIgniter4/...40c1b7b97b) @gra are you sure to use the latest version ? |
Welcome Guest, Not a member yet? Register Sign In |