0

As of Kohana 2.x documentation,pre_filter() will execute before validation of input fields but its not working as of expected.

I'm trying to trim input values entered by user before validation as,

$post = Validation::factory($_POST);
$post->pre_filter('trim');

If try to view the input value entered by user as,

echo 'a'.$post->name.'b'; // to observe white spaces appended alphabets 

echo's a john b,actually it should be ajohnb means still white spaces exists. What might the wrong in this ?

Mahesh.D
  • 1,691
  • 2
  • 23
  • 49

1 Answers1

0

You should do:

$post = Validation::factory($_POST);
$post->pre_filter('trim');
$post->validate();

Only when you call validate() pre filters are applied.

http://docs.kohanaphp.com/libraries/validation

Ramesh
  • 4,223
  • 2
  • 16
  • 24