Jump to content


How to debug easily a custom rule callback?

rules form validation callback

  • Please log in to reply
No replies to this topic

#1 Edwin K

Edwin K

    Newbie

  • Members
  • Pip
  • 4 posts
  • LocationRouen - FRANCE

Posted 18 January 2018 - 09:56 AM

Hi,

 

In my own validation rule callback, i want to check what is the content of each parameters for debugging.

Espacialy the second one in which i put 2 variables: $table and $field.

 

Here are the rules in the controller:

$table = 'companies';
$field = 'name';
$param = $field.'|'.$table;
$crud->set_rules('name', 'Name', 'trim|required|min_length[2]|max_length[50]|callback_is_unique_id_excluded['.$param.']');

And my callback:

public function is_unique_id_excluded($input, $param){
        echo 'input = '.$input.'<br>';
	echo 'param = '.$param.'<br><br>';

	//extract the field and table names on which  the rule is to apply
	list($field, $table) = explode('|', $param);

	etc...

But echo functions don't work even followed by a die to stop the validation process. Why?

 

So what is the best way to find errors in my form validation rule callback?

 

Thank you.

 

 







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users