filter form element [SOLVED]

I have a simple form.

$country =  new Text('country', array('required' => true,'class' => 'span12', 'data-sort' => 5));
$country->addValidator(new PresenceOf(array('message' => 'Пожалуйста,  укажите страну проживания.')));
$country->setFilters(array('trim, string'));
$country->setLabel('Страна');

/* other elements */

in cntrl

form->bind($_POST, $userEntity);

I get exception

```php Phalcon\Filter\Exception: Sanitize filter trim, string is not supported ```

but when I change setFilters to addFilter it works correct. What I'm doing wrong?

Problem solved: setFilters(array('trim', 'string'); =)



6.9k
edited Feb '17

you have error in setFilters method. Should be:

$country->setFilters(array('trim', 'string'));