Welcome Guest, Not a member yet? Register   Sign In
Shield validation question
#1
Wink 

Hello, I have question about shield for codeigniter 4. 
I have backend with form for edit and add new users. I use it like this:
PHP Code:
$this->validation->setRules([
    'username'        => 'is_unique[users.username,id,{user_id}]',
    'email'            => 'required|valid_email|unique_email[{user_id}]',
    'password'        => 'permit_empty|strong_password',
    'password_confirm' => 'matches[password]',
]);

if (!
$this->validation->withRequest($this->request)->run()) {
    return redirect()->back()->withInput()->with('errors'$this->validation->getErrors());
}
    

But when I submit a form, I expect to be redirected back to the form and show errors from validation. But I got CodeIgniter\Shield\Exceptions\ValidationException. 
I looked at sources and there is a trait for it - CheckQueryReturnTrait.
How to work with it, I just want to show validator errors like usual, but this throw exception and generate error.
Thank you.
Reply


Messages In This Thread
Shield validation question - by janroz - 07-25-2022, 05:01 AM
RE: Shield validation question - by kenjis - 07-25-2022, 06:15 PM
RE: Shield validation question - by chronic - 08-14-2022, 02:52 AM
RE: Shield validation question - by janroz - 08-14-2022, 04:41 AM
RE: Shield validation question - by chronic - 08-14-2022, 08:38 AM
RE: Shield validation question - by kenjis - 08-14-2022, 08:32 PM
RE: Shield validation question - by chronic - 08-15-2022, 02:16 AM
RE: Shield validation question - by kenjis - 08-15-2022, 02:20 AM
RE: Shield validation question - by chronic - 08-15-2022, 02:52 AM
RE: Shield validation question - by kenjis - 08-15-2022, 03:47 AM
RE: Shield validation question - by chronic - 08-15-2022, 08:10 AM
RE: Shield validation question - by kenjis - 08-15-2022, 02:57 PM
RE: Shield validation question - by chronic - 08-16-2022, 12:48 AM
RE: Shield validation question - by RedWd - 03-23-2024, 04:47 AM
RE: Shield validation question - by Codinglander - 03-27-2024, 07:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB