Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Multiple filtering/sanitizing on field

How can i use multiple filter on field? Like that striptags and trim together:

    $this->request->getPost('title', 'striptags|trim');


69.0k
Accepted
answer

Try with array as second parameter:

$this->request->getPost('title', ['striptags', 'trim']);


10.4k
edited May '16

Try with array as second parameter:

$this->request->getPost('title', ['striptags', 'trim']);

Ooww, i missed that! Really thanks ;)

Array can also be passed to a filter component:

   $num = $this->filter->sanitize($num, ['int', 'alphanum']);