Welcome Guest, Not a member yet? Register   Sign In
Messages for custom validations?
#3

[eluser]tomcode[/eluser]
If I remember right, one just has to create an entry in a language file with :
Code:
$lang['my_custom_validation_rule'] = "The %s field contains invalid characters.";

the validation method :
Code:
function my_custom_validation_rule($str)
{
       if ( preg_match("/[^0-9a-zA-Z\.,!#\/\(\)\s\-_\[\]']/", $str) )
       {
          return FALSE;
       }
       else
       {
            return TRUE;
       }
}

This should also work with set_message() method of the form_validation class. (Edit : if You don't use language files)


Messages In This Thread
Messages for custom validations? - by El Forum - 03-02-2010, 06:20 PM
Messages for custom validations? - by El Forum - 03-02-2010, 06:30 PM
Messages for custom validations? - by El Forum - 03-03-2010, 06:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB