1

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?

hrv
  • 925
  • 6
  • 13
Igor Belykh
  • 101
  • 5
  • 13

1 Answers1

2

https://github.com/kohana/core/blob/3.3/master/classes/Kohana/Validation.php#L192

there is an example how to use it

BlackScorp
  • 166
  • 2