Welcome Guest, Not a member yet? Register   Sign In
How to get old validation errors
#1

Hello!

I know that is possible to use the function old() to get items from a redirect()->withInput().

My doubt is: How to get old validation errors? Has a function for that?

PHP Code:
public function withInput()
    {
        
$session $this->ensureSession();

        
$input = [
            
'get'  => $_GET ?? [],
            
'post' => $_POST ?? [],
        ];

        
$session->setFlashdata('_ci_old_input'$input);

        
// If the validator has any errors, transmit those back
        // so they can be displayed when the validation is
        // handled within a method different than displaying the form.
        
$validator Services::validation();
        if (! empty(
$validator->getErrors()))
        {
            
$session->setFlashdata('_ci_validation_errors'serialize($validator->getErrors()));
        }

        return 
$this;
    } 


Thank you very much!
Reply


Messages In This Thread
How to get old validation errors - by falko - 02-26-2020, 02:21 PM
RE: How to get old validation errors - by MGatner - 03-01-2020, 08:54 AM
RE: How to get old validation errors - by falko - 03-05-2020, 10:57 AM
RE: How to get old validation errors - by falko - 03-08-2020, 03:09 PM



Theme © iAndrew 2016 - Forum software by © MyBB