Welcome Guest, Not a member yet? Register   Sign In
Form validation error message for length validations
#3

[eluser]helmutbjorg[/eluser]
On a follow up note, you can do it a better way like so...

Code:
// Custom max length
function max_length($str, $val) {
    if(!parent::max_length($str, $val)) {
        $this->set_message('max_length', str_relace('[count]', strlen($str), $this->CI->lang->line('my_max_length')));
        return false;
    }
    return true;
}

This way all of your existing code will still work! You can still use max_length (instead of my_max_length) in your validation lists. But the newer (more helpful) error message will show too!!


Messages In This Thread
Form validation error message for length validations - by El Forum - 01-11-2009, 06:48 PM
Form validation error message for length validations - by El Forum - 01-12-2009, 03:19 AM
Form validation error message for length validations - by El Forum - 01-15-2009, 08:44 AM
Form validation error message for length validations - by El Forum - 12-03-2010, 07:41 AM
Form validation error message for length validations - by El Forum - 04-23-2013, 06:27 PM
Form validation error message for length validations - by El Forum - 05-02-2013, 10:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB