![]() |
Form Validation not Working 4.2.12 -> 4.3.1 - 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: Form Validation not Working 4.2.12 -> 4.3.1 (/showthread.php?tid=86142) |
Form Validation not Working 4.2.12 -> 4.3.1 - kodokrawa - 01-15-2023 Need help After Update 4.2.12 to 4.3.1 Validation error not working, is there code need to change? Because error validation not show Please Controler BaseController.php PHP Code: <?php Controller Login.php PHP Code: class Login extends BaseController PHP Code: public function ceklogin() My View login_view.php PHP Code: <div class="mb-3"> RE: Form Validation not Working 4.2.12 -> 4.3.1 - kenjis - 01-15-2023 Yes, you need to change the code. See https://codeigniter4.github.io/CodeIgniter4/installation/upgrade_430.html#redirect-withinput-and-validation-errors RE: Form Validation not Working 4.2.12 -> 4.3.1 - kodokrawa - 01-16-2023 (01-15-2023, 05:27 PM)kenjis Wrote: Yes, you need to change the code. Thank You it works but value="<?= old('field_name')?>" not return the old value after error message how to resolve this Sir? RE: Form Validation not Working 4.2.12 -> 4.3.1 - kenjis - 01-16-2023 old() did not change. It should work as before. How do you use it? Sample code? RE: Form Validation not Working 4.2.12 -> 4.3.1 - kodokrawa - 01-18-2023 (01-16-2023, 08:02 PM)kenjis Wrote: old() did not change. It should work as before.My Controller Login.php PHP Code: public function ceklogin() This is my View Page Login.php PHP Code: <?php $validation = \Config\Services::validation(); ?> When Validation is-invalid old input value not show RE: Form Validation not Working 4.2.12 -> 4.3.1 - kenjis - 01-18-2023 old() needs redirect()->withInput() in the previous page(request). See https://codeigniter.com/user_guide/general/common_functions.html#old I think your code does not work in v4.2. You need to use Form helper set_value(). See https://github.com/kenjis/ci4-validation-tutorial RE: Form Validation not Working 4.2.12 -> 4.3.1 - kodokrawa - 01-19-2023 (01-18-2023, 06:10 PM)kenjis Wrote: old() needs redirect()->withInput() in the previous page(request). Thanks you Sir, its Works RE: Form Validation not Working 4.2.12 -> 4.3.1 - maulana_rcr07 - 08-22-2023 my code not works yet, can you provide a view code that showing an errors? RE: Form Validation not Working 4.2.12 -> 4.3.1 - kenjis - 08-23-2023 See https://github.com/kenjis/ci4-validation-tutorial/blob/main/app/Views/form2.php |