validation_errors |
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
Ok. Probably because you use built-in validation. There is no need for it to be saved between sessions.
https://codeigniter4.github.io/userguide...ion-errors (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.
|
Welcome Guest, Not a member yet? Register Sign In |