[Solar-talk] adding filter validate class

Jeff Surgeson solar at 3hex.com
Thu Mar 6 07:48:06 CST 2008


Hi All

I know that a similar question was asked in previous months but I cant make it 
work as my useage is slightly differant.

I am trying to add a filter method to validate form user input, I also wanted 
to set it up so I could add other validation and sanitize methods unique to 
my use, this is what I have done. 

class Vendor_Filter extends Solar_Filter{}

class Vendor_Filter_ValidateMethod extends Solar_Filter_Abstract {
	public function validateMethod(){
	// validate code
	}
}

In my application class I have a method to create a form which calls the 
validate method

public function contactForm()
{
	$form = Solar::factory('Solar_Form');
        $form->setElements(array(
            'telno'    => array(
                'filters'       => array(
                        'validateMethod',
                ),
	.....
	.....
}

I tried adding protected $_filter_class = 'Vendor_Filter'; to my application 
class.

It generates an exception as class not found, I assume as it is only searching 
Solar_Filter and not Vendor_Filter. It would appear from what Paul and Anttih 
say that it is possible when used in a Model class

Am I on the right track doing it as above and if so what am I missing?

-- 
...........::::::...........
Jeff Surgeson / South Africa


More information about the Solar-talk mailing list