Welcome Guest, Not a member yet? Register   Sign In
Custom error message in validation
#1

(This post was last modified: 11-16-2023, 01:18 AM by pippuccio76.)

Hi i have this simply validation rules :
Code:
    public function mancanti_bolla($value, ?string &$error = null , array $data): bool
    {
        //dd($value);




        $error = "Error for mancanti_bolla";

        return false;


        //controllo i mancanti

    }
But in my view i have : 
Validation.mancanti_bolla instead of  Error for mancanti_bolla.

How can i set custom error message?
Reply
#2

See https://codeigniter4.github.io/CodeIgnit...rule-class

PHP Code:
public function even($value, ?string &$error null): bool 
Reply
#3

(11-16-2023, 01:37 AM)kenjis Wrote: See https://codeigniter4.github.io/CodeIgnit...rule-class

PHP Code:
public function even($value, ?string &$error null): bool 

solved  by passing parameter in this way :

Code:
    public function mancanti_bolla(string $str,string $fields, array $data, ?string &$error = null ): bool
Reply




Theme © iAndrew 2016 - Forum software by © MyBB