Welcome Guest, Not a member yet? Register   Sign In
Form Validation Config File
#1

(This post was last modified: 04-19-2020, 12:29 PM by jreklund.)

Hello, I am new on this forum
I have problem with creating a form_validation.php file for entire application validation
I want custom error message for regex_match but. I got Default Error Validation Message

PHP Code:
//form validation regular expression
defined('NAME_EXP') OR define('NAME_EXP''[a-zA-Z .\-]+$');

'applicant' => [
    'field' => 'full_name',
    'label' => 'Applicant Name',
    'rules' => 'trim|required|max_length[255]|min_length[3]|regex_match[/' NAME_EXP '/]',
    'errors' => [
        'regex_match[/' NAME_EXP '/]' => "The %s field may only contain Alphabetic characters, Fullstops(.), Hyphens(-) and spaces( )."
    ]

Reply
#2

Hi, you should do it like this:

PHP Code:
'errors' => [
        
'regex_match' => ...
    ] 
Reply
#3

thank you. it works fine
Reply




Theme © iAndrew 2016 - Forum software by © MyBB