Matthew Weier O'Phinney-3 wrote:
> 
> 
>> I thought that adding the prefex path to the form itself made the path
>> available to all of the elements? Am I missing something?
> 
> It does... as long as:
> 
>   * you're adding the prefix path *before* creating elements
>   
>   * AND you're creating the elements via the form object's addElement()
>     or createElement() methods
> 
> 
Here is my form code:
class forms_TestvalForm extends Zend_Form
{
   public function __construct($options = null)
   {
      parent::__construct($options);
      $this->addElementPrefixPath('My','My/');
      $this->setName('testval');


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

      //$testing->addPrefixPath('My','My/');

      $testing->addValidator('TestVal');
      $this->addElement($testing);


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

      $this->addElement($submit);

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

If I uncomment //testing->addPrefixPath('My,'My/'); it works; otherwise not.
Any suggestions as to what I'm doing wrong here?

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

Reply via email to