Welcome Guest, Not a member yet? Register   Sign In
set_value() not working on custom validation field
#4

[eluser]Aken[/eluser]
The problem is you aren't returning TRUE in your valid_date() callback if the field passes. This returns the NULL value, which the form validation library assumes as you altering the value rather than validating it (kind of like running trim() - it alters the value).

Do something like this instead:

Code:
public function valid_date($val)
{
    return (bool) preg_match('^(0[1-9]|1[012])[/](0[1-9]|[12][0-9]|3[01])[/](19|20)\d\d$^', $val);
}


Messages In This Thread
set_value() not working on custom validation field - by El Forum - 07-30-2012, 07:13 AM
set_value() not working on custom validation field - by El Forum - 07-30-2012, 01:04 PM
set_value() not working on custom validation field - by El Forum - 07-30-2012, 01:06 PM
set_value() not working on custom validation field - by El Forum - 07-30-2012, 01:09 PM
set_value() not working on custom validation field - by El Forum - 07-30-2012, 01:11 PM
set_value() not working on custom validation field - by El Forum - 07-30-2012, 01:13 PM
set_value() not working on custom validation field - by El Forum - 07-30-2012, 09:42 PM
set_value() not working on custom validation field - by El Forum - 08-31-2013, 04:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB