Zend Form Custom Validation Path issues?

You have to add the directory where you have your custom validators to your form elements prefix path. For example: $elementPrefixPaths = array( array( array( 'prefix' => 'My_Validate_', 'path' => 'My/Validate', // 'application/validators' in your case 'type' => 'validate', ) ) ); $form->addElementPrefixPaths($elementPrefixPaths); // or, if your're inside the form, // $this->addElementPrefixPaths($elementPrefixPaths) // before any elements make use of the validator The 'path' should be in your include path. You have to do the same with your custom filters.

Also there is a similar approach for custom decorators and elements (which use the method setPrefixPaths() instead) Read more here Your path is 'application/validators', but it would be better to follow ZF convention on class naming and path mirroring; as such you should put your validator in a directory such as 'My/Validate' You should follow this convention on all custom ZF extensions you develop (filters, helpers, plugins, etc). It will make your life easier in the long run. Also, as a final suggestion, don't use "My_" as your classes prefix, use something more personal, such as "Mem_" (considering your nickname).

You have to add the directory where you have your custom validators to your form elements prefix path. For example: $elementPrefixPaths = array( array( array( 'prefix' => 'My_Validate_', 'path' => 'My/Validate', // 'application/validators' in your case 'type' => 'validate', ) ) ); $form->addElementPrefixPaths($elementPrefixPaths); // or, if your're inside the form, // $this->addElementPrefixPaths($elementPrefixPaths) // before any elements make use of the validator. The 'path' should be in your include path.

You have to do the same with your custom filters. Also there is a similar approach for custom decorators and elements (which use the method setPrefixPaths() instead). Read more here.

Your path is 'application/validators', but it would be better to follow ZF convention on class naming and path mirroring; as such you should put your validator in a directory such as 'My/Validate' You should follow this convention on all custom ZF extensions you develop (filters, helpers, plugins, etc). It will make your life easier in the long run. Also, as a final suggestion, don't use "My_" as your classes prefix, use something more personal, such as "Mem_" (considering your nickname).

I still think my answer here may work for you and is worth a try. Is there a particular reason you don't like this way? Zend Framework - Where should we place our custom Validators?

I would have posted this as a comment, but I don't have enough rep for that yet :(.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send