0
votes

My config file with my validation rules works fine when calling the form_validation->run('form'). The thing is that I want to set custom error message for one of the fields. So in the controller I just add: ..set_message('field','message'). But it's not registering, I get the default error message: .... is required.

1

1 Answers

0
votes

For changing the message for the existing validation rules, just do the following.

  1. Copy the form_validation_lang.php file from system/language/english to application/language/english
  2. Modify the message for your validation rule name.

For example for changing message for required field change the below line.

    $lang['required']           = "The %s field is required.";