![]() |
validation_errors - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: validation_errors (/showthread.php?tid=91083) |
validation_errors - elephpantech - 06-13-2024 Why the function validation_errors() in form helper does not work with In-Model Validation? I must enter this in any controller to work: $this->session->setFlashdata('_ci_validation_errors', $model->errors()); Kind regards RE: validation_errors - ozornick - 06-13-2024 Ok. Probably because you use built-in validation. There is no need for it to be saved between sessions. https://codeigniter4.github.io/userguide/models/model.html#getting-validation-errors RE: validation_errors - kenjis - 06-13-2024 (06-13-2024, 01:05 PM)elephpantech Wrote: Why the function validation_errors() in form helper does not work with In-Model Validation? A Model has its own Validation instance. Because you can use many Models in a request. For example, If you have used two Models, there are two Validation instance. validation_errors() checks the shared Validation instance by CI4 Services. The shared Validation instance is a different instance from the Validation instances in the Models. After all, there is no way that validation_errors() gets the Validation instance that you want to show the error. RE: validation_errors - elephpantech - 06-18-2024 It was very clear, thank you Good work!!! |