We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

[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?



98.9k

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.



8.1k
Accepted
answer

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.