![]() |
Custom form validation - 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: Custom form validation (/showthread.php?tid=86259) |
Custom form validation - chakycool - 01-24-2023 Hi All, I has a custom form validation created just like the one on this tutorial (https://makitweb.com/create-custom-validation-rule-in-codeigniter-4/) and was working fine on 4.2.1. I just updated the core to 4.3.1 and the form validation errors are not been displayed on the view. Validation work and I can catch the custom error msg on the controller but it's not working on the view. Basically I load the service on the view and print the error as per below. Any idea why this is not working on 4.3.1 ? Code: //load the service RE: Custom form validation - kenjis - 01-24-2023 See https://codeigniter4.github.io/CodeIgniter4/installation/upgrade_430.html#redirect-withinput-and-validation-errors Try: PHP Code: <?php $validation = \Config\Services::validation(); ?> RE: Custom form validation - chakycool - 01-24-2023 Thanks Kenjis, I went with the below code on the view if someone else run in to this issue. Code: echo session('validation') ? session('validation')->getError('email') : ''; you can also go with the very sort method as below and not load the service on the view at all. Code: <?=validation_show_error('email') ?> |