Two possible solutions:
1) you're not using the naming conventions correctly; if your directory structure is
library/
library/Zend
library/MyCode
library/MyCode/Validator/MyValidator.php
then your validator class should be called MyCode_Validator_MyValidator and you can then instantiate it with $validator = new MyCode_Validator_MyValidator();
2) read the docs for Zend_Loader_Autoload and check that it is set up correctly for your use-case.
Yours,
Mark
Writing the custom validator is same but how I am going to use it in my page? It shows some zend exception from loader. I think i need to define the path some how? In examples on net i have seen something like $element->pathPrefix..(...) to set the path for custom validator, But here i dont have any Zend form or zend form element. So how do i register my custome validator?
Thanks.
David Mintz-2 wrote:
On Tue, Jun 30, 2009 at 7:36 AM, mnaveed <mnaveed_19@hotmail.com> wrote:
>
> Can anyone please guide me how to use a custom validator with an exisiting
> application. Please note that the application is not using Zend MVC modal
> and zend forms.
> I am able to use the builtin validations/filters to validate my data but
> not
> been able to use a custom validator.
>
I'd think you would do the same as you would in a full-blown ZF project:
extend Zend_Validate_Abstract (or implement Zend_Validate_Interface) and
away you go.
http://framework.zend.com/manual/en/zend.validate.writing_validators.html--
David Mintz
http://davidmintz.org/The subtle source is clear and bright
The tributary streams flow through the darkness