Guest User

Untitled

a guest
May 22nd, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.61 KB | None | 0 0
  1.     <?php
  2.     class Form_InserirForm extends Zend_Dojo_Form
  3.     {
  4.  
  5.         public function __construct($option = null) {
  6.             parent::__construct($option);
  7.            
  8.             $this->setName('inserirartigo')
  9.                 ->setAttrib('enctype', 'multipart/form-data');
  10.            
  11.             $username = new Zend_Form_Element_Text('username');
  12.             $username->setLabel('User name:')
  13.                      ->setRequired();
  14.                      
  15.             $password = new Zend_Form_Element_Password('password');
  16.             $password->setLabel('Password:')
  17.                      ->setRequired(true);
  18.                
  19.                
  20.           /*$image = new Zend_Form_Element_File('image_name');
  21.             $image->setLabel('Upload an image:')
  22.                   ->setDestination('/save')
  23.                   ->addValidator('Size', '500kb');
  24.              */
  25.           $element = new Zend_Form_Element_File('foo');
  26.          
  27.           $element->setLabel('Upload an image:')      
  28.                 ->setDestination('e:\save')      
  29.                 ->setRequired(false);
  30.                
  31.           $element->addValidator('Size', false, 102400);
  32.          
  33.           $this->addElement($element, 'foo');
  34.           // The foo file element is optional but when it's given go into here
  35.           if ($this->foo->isUploaded())
  36.           {    // foo file given... do something
  37.           }
  38.        
  39.                      
  40.                    
  41.             $login = new Zend_Form_Element_Submit('login');
  42.             $login->setLabel('Guardar');
  43.            
  44.             $this->addElements(array($username, $password, $login));
  45.             $this->setMethod('post');
  46.             $this->setAction(Zend_Controller_Front::getInstance()->getBaseUrl().'/imoveis/inserirartigo');
  47.         }
  48.  
  49.  
  50.  
  51.  
  52.  
  53.           /*»  public function __construct($options = null)
  54.             {
  55.                     parent::__construct($options);
  56.                     $this->setName('article_form')
  57.                             //->setAction(URL.'/save')
  58.                             ->setMethod('post')
  59.                             ->setAttrib('enctype', 'multipart/form-data')
  60.                             ->setAttrib('id', 'article-form');
  61.                              
  62.                     $title = new Zend_Form_Element_Text('titulo');
  63.                     $title->setLabel('Titulo')
  64.                             ->setRequired(true)
  65.                             ->addValidator('NotEmpty')
  66.                             ->setAttribs(array('size'=>'40'))
  67.                             ->addValidator('StringLength', false, array(1, 128));
  68.                    
  69.                     $author = new Zend_Form_Element_Text('author');
  70.                     $author->setLabel('Author')
  71.                             ->setRequired(true)
  72.                             ->setAttribs(array('size'=>'40'))
  73.                             ->addValidator('NotEmpty')
  74.                             ->addValidator('StringLength', false, array(1, 64));
  75.                            
  76.                     $image = new Zend_Form_Element_File('image_name');
  77.                     $image->setLabel('Upload an image:')
  78.                             ->setDestination(AP . '/save')
  79.                             ->addValidator('Size', '500kb');
  80.  
  81.                     $submit = new Zend_Form_Element_Submit('action');
  82.                     $submit->setLabel('Save');
  83.                                    
  84.                     $this->addElements(array(
  85.                             $title, $author, $image, $submit
  86.                     ));
  87.             } */
  88.          
  89.          
  90.          
  91.     }
  92.  
  93.  
  94.     ?>
Add Comment
Please, Sign In to add comment