⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

How to debug easily a custom rule callback?



Edwin K
  • profile picture
  • Member

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.