Skip to content

Bug: Custom Validation Error Messages #3097

Description

@durbintl

The CI4 documentation mentions setting validation rules and error messages in a configuration file. https://codeigniter4.github.io/userguide/libraries/validation.html?highlight=upload#how-to-save-your-rules. It states, "You can also store custom error messages in this configuration file by naming the property the same as the group, and appended with _errors. ...Or pass all settings in an array...." Currently passing all settings in an array is not functional and you must set your custom errors with the _errors method.

CodeIgniter 4 version
CI Version 4.0.3, Branch Master

Affected module(s)
Validation Class

Expected behavior, and steps to reproduce if appropriate
The code below should be returning the custom error messages as set in the Language File.

/app/Config/Validation.php
public $login = [ 'user' => [ 'label' => 'rules.login.user.label', 'rules' => 'required', 'errors' => [ 'required' => 'rules.login.user.errors.required' ], ], ];

Context

  • OS: OS X 10.15.5
  • Web server: Local Development Server (Spark)
  • PHP version: 7.4.5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions