Reputation: 101
I have a problem with Kohana's validation object. For example, I want to check the user_id
field. It has to be a number and greater then 0. I've tried following:
$validation->rule("user_id", function($str){
return (is_numeric($str) && $str > 0);
}
Also I put into the field, just a string "sdfgwertxcvb". But the $validation->check() returns "TRUE". Why?
Please, explain to me what did I do wrong?
Upvotes: 1
Views: 239
Reputation: 166
https://github.com/kohana/core/blob/3.3/master/classes/Kohana/Validation.php#L192
there is an example how to use it
Upvotes: 2