Welcome Guest, Not a member yet? Register   Sign In
Issue with form validation
#1

Here is my code -

This gives me "Undefined property: App\Controllers\Home::$validation" error.
Code:
public function login()
    {

        if (! $this->validate([
            'email' => 'required',
            'password'  => 'required'
        ])) {
            echo Services::plates('login', [
                'validation' => $this->validation
            ]);
        } else {
            //'title' => $this->request->getVar('title'),
        }

    }

However, I can fix this error using this b
Code:
$validation =  \Config\Services::validation();
but I think as per documentation I should be able to pass validation object as above.

Another issue is in the view
Code:
<?= $validation->listErrors() ?>

It just shows me error messages for the given rules above without even submitting the form along with the name of the validation view file name.

Code:
1 ROOTPATH/system/Validation/Views/list.php

    The email field is required.
    The password field is required.

What am I doing wrong?
Reply


Messages In This Thread
Issue with form validation - by happyape - 09-27-2018, 12:47 AM
RE: Issue with form validation - by InsiteFX - 09-27-2018, 04:04 AM
RE: Issue with form validation - by happyape - 09-27-2018, 05:32 AM
RE: Issue with form validation - by unodepiera - 09-30-2018, 12:26 AM
RE: Issue with form validation - by InsiteFX - 09-30-2018, 03:57 AM
RE: Issue with form validation - by unodepiera - 09-30-2018, 10:48 AM
RE: Issue with form validation - by happyape - 09-30-2018, 02:46 PM
RE: Issue with form validation - by unodepiera - 09-30-2018, 10:47 PM
RE: Issue with form validation - by happyape - 10-01-2018, 12:47 AM
RE: Issue with form validation - by unodepiera - 10-01-2018, 01:18 AM
RE: Issue with form validation - by happyape - 10-01-2018, 01:55 AM
RE: Issue with form validation - by dave friend - 10-01-2018, 09:16 AM
RE: Issue with form validation - by InsiteFX - 10-01-2018, 10:40 AM
RE: Issue with form validation - by dave friend - 10-01-2018, 11:05 AM
RE: Issue with form validation - by InsiteFX - 10-01-2018, 12:08 PM
RE: Issue with form validation - by Ekley - 10-11-2019, 07:22 AM
RE: Issue with form validation - by Bart Goossens - 08-22-2020, 08:58 AM
RE: Issue with form validation - by jreklund - 08-22-2020, 12:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB