Welcome Guest, Not a member yet? Register   Sign In
Form Validation - returns "(Anonymous function)"
#1

(This post was last modified: 03-13-2018, 07:02 AM by sintakonte.)

Hey guys,

i migh've found some bug.

In the docs there is a section called Callable use anything as a rule

I've an object where i do the following
PHP Code:
$this->ci()->load->model('admin/person/Cppersonsave_model');
$this->arrValidationRules[] = array(
    
'field' => 'personid',
    
'label' => 'Duplicatecheck',
    
'rules' => array('check_duplicates', array($this->ci()->Cppersonsave_model,'duplicatesCheck'))
); 




After that i ran the Validation like

PHP Code:
$this->ci()->form_validation->reset_validation();

$this->ci()->form_validation->set_data($arrDbFields);
$this->ci()->form_validation->set_rules($this->arrValidationRules);
if (!
$this->ci()->form_validation->run())
{
    throw new 
FormValidation_Exception(json_encode($this->ci()->form_validation->error_array()));


an excerpt of the model function looks like

PHP Code:
if ($col->count() > 0)
{
    
$this->form_validation->set_message('check_duplicates''This person already exists!');
}

return (
$col->count() > 0   false      true

My model function get called correctly.


But if i do that an error message appears (Anonymous function)

i debugged the code and got the following information 

In line 687 in the Form_validation Library the variable callable is set to true.
On Line 741 the $rule variable gets the callable value which is a boolean and therefore true.


This leads to line 799 which exactly put my message out.

Am i'm missing something here or is this a bug ?

Thx in advance for your answers
Reply


Messages In This Thread
Form Validation - returns "(Anonymous function)" - by sintakonte - 03-13-2018, 06:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB