CodeIgniter Forums
redirect with input - 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: redirect with input (/showthread.php?tid=75020)



redirect with input - snelledre - 12-09-2019

Best,

I have made an form with some input.
When the validation is not ok then you can use
PHP Code:
return redirect()->back()->withInput(); 
And in the form you can use "old"as value so the input field is automatic filled with the old value.

But i use model validation how can i send the errors with the return redict withinput.

I know there is another way but that is more code, i was wondering if it is possible.

André


RE: redirect with input - InsiteFX - 12-10-2019

PHP Code:
return redirect()->back()->withInput()->with('errors'$this->validator->getErrors()); 

That is how Lonnie doe's it in his Myth/Auth I would download Myth/Auth and look at
the AuthController to see how Lonnie doe's this and alot more.

Myth:Auth


RE: redirect with input - snelledre - 12-11-2019

(12-10-2019, 09:04 AM)InsiteFX Wrote:
PHP Code:
return redirect()->back()->withInput()->with('errors'$this->validator->getErrors()); 

That is how Lonnie doe's it in his Myth/Auth I would download Myth/Auth and look at
the AuthController to see how Lonnie doe's this and alot more.

Myth:Auth

Thanx,

With the help off Myth:Auth it works fine now.
It's a good project for leaning.

Andre