• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
From Validation Bug or Syntax

#1
I'm trying to call a custom validation method (), which reside in a custom library (). But I'm getting a CI error in libraries/Form_validation.php.
Not sure if this is a bug of a problem with my syntax. Code snipits below.

CONTROLLER
Code:
$this->form_validation->set_rules('name', 'Name', array($this->custom_validation_lib, '_alpha_custom'));

LIB
Code:
public function _alpha_custom($str){
    if(preg_match('/^[a-z\s\-\,\.\']*$/i', $str))
        return TRUE;
    else
        return FALSE;
}      


OUTPUT
A PHP Error was encountered

Severity: Warning

Message: preg_match() expects parameter 2 to be string, object given

Filename: libraries/Form_validation.php

Line Number: 693
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.