Welcome Guest, Not a member yet? Register   Sign In
Form validation callbacks not working
#9

The set_message method allows you to set your own error messages on the fly. But one thing you should notice is that the key name has to match the function name that it corresponds to.

If you need to modify your custom rule, which is _check_valid_username, you can do so by perform set_message within this function:

function _check_valid_username($str)
{
// Your validation code
// ...
// Put this in condition where you want to return FALSE
$this->form_validation->set_message('_check_valid_username', 'Error Message');
//
}
If you want to change the default error message for a specific rule, you can do so by invoking set_message with the first parameter as the rule name and the second parameter as your custom error. E.g., if you want to change the required error :

$this->form_validation->set_message('required', 'Oops this %s is required');
If by any chance you need to change the language instead of the error statement itself, create your own form_validation_lang.php and put it into the proper language folder inside your system language directory.
I will not SEO spam!
Reply


Messages In This Thread
RE: Form validation callbacks not working - by dexusmedia - 02-04-2019, 08:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB