We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

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.

[Solved] Using a custom filter for Forms\Element ?

With Phalcon\Filter we can add our own filters.

We can also set filters for form elements, when validating them.

I want to set a custom filter (using a class) for a form element. Is that possible?


Just use the name of the filter you used to register it. Phalcon\Forms will inject the 'filter' service and request a filter with the same name to it.


Got it working, registered the filter service and added my custom filter to it. Thanks guys!

Hi @Ren,

I'm new to Phalcon, can you provide a detailed steps on how to add custom filter? I tried following the docs, it doesn't seem to work on me.