![]() |
CI4 equivalent of $this->form_validation->set_data($data); - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: CI4 equivalent of $this->form_validation->set_data($data); (/showthread.php?tid=77259) |
CI4 equivalent of $this->form_validation->set_data($data); - mokalovesoulmate - 08-08-2020 Hello, I need to validate a value outside of $_POST data. In CI3 I could easily manually assign data before running validation: PHP Code: $data = array( But it seems this feature is not exist on CI4. How to do this? Thanks. RE: CI4 equivalent of $this->form_validation->set_data($data); - jreklund - 08-08-2020 Hi, you do it like this. PHP Code: $validation = \Config\Services::validation(); RE: CI4 equivalent of $this->form_validation->set_data($data); - mokalovesoulmate - 08-08-2020 (08-08-2020, 12:09 PM)jreklund Wrote: Hi, you do it like this. It worked, thanks. Reference: https://codeigniter4.github.io/userguide/libraries/validation.html#setting-custom-error-messages Final code: PHP Code: $data = array( |