Welcome Guest, Not a member yet? Register   Sign In
Validation doesn't work
#4

(02-27-2024, 09:25 PM)kenjis Wrote: When the field is empty (invalid), you redirect to "/comic/create".
That is the browser send another request to the server.
So the $validation in the view is not the same instance as the Validation instance in the first request.

You saved the Validation instance into the flash message in the session.
You need to get it from the session.

See https://codeigniter4.github.io/CodeIgnit...ion-errors

Thank you! This one is work for me as well, I don't know if it's the good or the perfect one but at least, I've tried to find the code by myself and proud of myself because I can figure it out.  Cool

PHP Code:
<?= session()->getFlashdata('validation') ? 'is-invalid' '';  ?>
Reply


Messages In This Thread
Validation doesn't work - by Tokioshy - 02-27-2024, 07:15 PM
RE: Validation doesn't work - by kenjis - 02-27-2024, 09:25 PM
RE: Validation doesn't work - by Tokioshy - 02-28-2024, 01:47 AM
RE: Validation doesn't work - by MZahov - 02-27-2024, 10:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB