On Tue, Jun 16, 2009 at 10:25 PM, Matthew Ratzloff<m...@builtfromsource.com> wrote: > 1. Your own library. library/My/Filter/Foo.php > 2. > http://framework.zend.com/manual/en/zend.form.elements.html#zend.form.elements.filters > -Matt
OK I got the concept of custom filter. Now I have custom filter implemented but it is not working. I have /application /library /My /Filter Interface.php Slash2Comma.php Basically my idea is to replace the slash(/) with comma and this is how it looks like Interface.php ++++++++++++++ <?php interface Zend_Filter_Interface { /** * Returns the result of filtering $value * * @param mixed $value * @throws Zend_Filter_Exception If filtering $value is impossible * @return mixed */ public function filter($value); } +++++++++++++++ Slash2Comma.php +++++++++++++++++ <?php require_once 'Zend/Filter/Interface.php'; class Zend_Filter_Slash2Comma implements Zend_Filter_Interface { /** * Defined by Zend_Filter_Interface * * Returns the string $value, replacing all forward slashes to comma * * @param string $value * @return string */ public function filter($value) { $temparr = explode("/", $value); $replacedvalue = implode (",", $temparr); return (string) $replacedvalue; } } ++++++++++++++++ In My Form element, I have added my custom filter The code fragment in my form looks like this ++++++++++++ public function init() { $mysearch = New Zend_Form_Element_Text('srchstr'); $mysearch->setLabel('Search For:'); $mysearch->setAttrib('size', '30'); $mysearch->addPrefixPath('My_Filter', 'My/Filter/', 'filter'); $mysearch->addFilter('Slash2Comma'); $mysearch->addFilter('StringTrim'); ... ... ... } +++++++++++++++ Now when I var_dump my query string, it is still the same. What's wrong with my Slash2Comma code? Any suggestion? Besides that if i execute query, i am getting SQL error Just need some input. Thanks again for your valuable time