Ver Mensaje Individual
  #7 (permalink)  
Antiguo 22/04/2011, 22:09
Avatar de abimaelrc
abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 15 años
Puntos: 1517
Respuesta: Zend_Validate_Callback

Intente usar el addElementPrefixPath y tampoco me funcionó
Código PHP:
Ver original
  1. <?php
  2. class Reports_Form_Foo extends Zend_Form
  3. {
  4.     public function init()
  5.     {
  6.         $n=1;
  7.         // initialize form
  8.         $this->setMethod('post')
  9.             ->addElementPrefixPath('Reports_Model', 'reports/models/',
  10.                             Zend_Form_Element::VALIDATE)
  11.             ->setAttrib('accept-charset', 'utf-8')
  12.             ->setDecorators(
  13.                 array(
  14.                     'FormElements',
  15.                     'Form',
  16.                 )
  17.             );
  18.  
  19.         // create select input for foo
  20.         $foo = new Zend_Form_Element_Select('foo');
  21.         $foo->setLabel('Foo:')
  22.             ->setDecorators(
  23.                 array(
  24.                     'Errors',
  25.                     'ViewHelper',
  26.                     array('HtmlTag', array('tag'=>'div')),
  27.                     array('Label', array('tag'=>'div')),
  28.                 )
  29.             )
  30.             ->addValidator('ExtraValidate')
  31.             ->setOptions(array('tabindex'=>$n++));
  32.         $fooArray = array(
  33.             ''=>'[Selecciona uno]',
  34.             'Foo' => array(
  35.                 1=>'Foo',
  36.                 2=>'Bar'
  37.             ),
  38.             'Baz' => array(
  39.                 3=>'Baz',
  40.                 4=>'Candy',
  41.                 5=>'Fruits'
  42.             ),
  43.         );
  44.         $foo->addMultiOptions($fooArray);
  45.  
  46.         // create submit button
  47.         $submit = new Zend_Form_Element_Submit('submit');
  48.         $submit->setLabel('Submit')
  49.             ->setOptions(array('class' => 'submit', 'tabindex'=>$n++))
  50.             ->setDecorators(
  51.                 array(
  52.                     'ViewHelper',
  53.                     array('HtmlTag', array('tag'=>'div')),
  54.                 )
  55.             );
  56.  
  57.  
  58.         $this->addElements(
  59.             array(
  60.                 $foo,
  61.                 $submit
  62.             )
  63.         );
  64.     }
  65. }
Hace nada
__________________
Verifica antes de preguntar.
Los verdaderos amigos se hieren con la verdad, para no perderlos con la mentira. - Eugenio Maria de Hostos