Welcome Guest, Not a member yet? Register   Sign In
Custom Validation doesn't work?
#1

Hi, I want to create custom validation rule but it not working.

Config/Validation

Code:
    public function test_validate(string $str, string &$error = null): bool
    {
        $error = 'test error';
        return false;
    }

App\Model
Code:
    protected $validationRules = array(
        'name'     => 'required|test_validate'
    );

Result
Quote:CodeIgniter\Validation\Exceptions\ValidationException

{0} is not a valid rule.

For additional question, can someone give simpler example how to send parameters to the function? I don't get the 'require_with' example.
https://codeigniter4.github.io/CodeIgnit...-parameter

The new validation system is hard to understand compared to the previous callback system.
Reply


Messages In This Thread
Custom Validation doesn't work? - by sibiniv - 12-06-2018, 11:34 PM
RE: Custom Validation doesn't work? - by kilishan - 12-07-2018, 08:23 AM
RE: Custom Validation doesn't work? - by sibiniv - 12-09-2018, 07:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB