Custom validator

edited March 2011 in Modules
How do I create a custom validator for the validator class?
$this->validator->add_rule('field', 'func', 'msg', 'params')

I can insert my own function within the validator helper but I don't want to put it in there if I'm only going to use it once. Help?


  • edited 3:08PM
    If it is specific to say a model, then sometimes I'll add the validation function on the model and instead of the function name I'll use array($this, 'my_func'). However, you can use the create_funciton() php function to create a lamda function.
  • DatDat
    edited 3:08PM
    Alright thanks I'll use the array($this, 'my_function')!
Sign In or Register to comment.