Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Validation not working #2418

Closed
rsRamgharia opened this issue Nov 19, 2019 · 2 comments
Closed

Bug: Validation not working #2418

rsRamgharia opened this issue Nov 19, 2019 · 2 comments
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@rsRamgharia
Copy link

Validation is not working if the key is not present in array.

$data = [ 'name' => $name, 'email' => $email, 'password' => $password ];
if i remove any key from the array, then model will never validate that key

protected $validationRules    = [
        'name'     => 'required|alpha_numeric_space|min_length[4]',
        'email'    => 'required|valid_email|is_unique[users.email]',
        'password' => 'required|min_length[6]',
    ];

Screenshot from 2019-11-19 13-13-54

See the above image i remove password from the array and model doesn't validate that field

@rsRamgharia rsRamgharia added the bug Verified issues on the current code behavior or pull requests that will fix them label Nov 19, 2019
@SunilEver
Copy link

Please follow template provided for the bug report. https://github.com/codeigniter4/CodeIgniter4/blob/develop/.github/ISSUE_TEMPLATE/bug_report.md
This will help understand the issue better.

@lonnieezell
Copy link
Member

Not a bug. The validation library is designed to validate the keys' values against the rules. It is the developer's job to ensure they pass they proper keys in. This allows validation rules to be used for both inserts and updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

No branches or pull requests

3 participants