Matthew Weier O'Phinney-3 wrote:
> 
> -- chinaski <[EMAIL PROTECTED]> wrote
> 
> The problem is right here: for the form's elementPrefixPath setting to
> have any effect on an element, the element must be created using the
> form object's addElement() or createElement() methods. Try this instead:
> 
>     $testing = $this->createElement('text', 'testing');
> 
> and you should see better results (you'll need to do it for all
> methods). If you use createElement(), don't forget to attach the
> elements later using addElement(), addElements(), or setElements().
> 
> 
Thanks Matthew. That works. Here's the final form with the issue solved...

      parent::__construct($options);
      $this->addElementPrefixPath('My','My/');

      $testing = $this->createElement('text','testing');

      $testing->setLabel('Test Value')
      ->setRequired(true);

      $testing->addValidator('TestVal');

      $submit = new Zend_Form_Element_Submit('submit');
      $submit->setLabel('submit');

      $this->addElements(array($testing,$submit));

      $this->setAction('/formtest/testval/')
      ->setMethod('post');


-- 
View this message in context: 
http://www.nabble.com/custom-form-validator-tp16628634p16731976.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to