Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZF] Problem z Udekorowaniem elementu "file", Chcać udekorować pole typu file otrzymuje błąd.
Sajrox
post
Post #1





Grupa: Zarejestrowani
Postów: 254
Pomógł: 7
Dołączył: 9.10.2007
Skąd: Poznań

Ostrzeżenie: (0%)
-----


Witam,

Otoż chciałbym udekorować element file tak samo jak pole text czy textarea. Niestety w momencie dodania obiektu file do formularza otrzymuje błąd:

Kod
Warning: No file decorator found... unable to render file element in C:\wamp\www\library\Zend\Form\Element.php on line 1931

Gdy z typu pola zmienie z file na text to wszystko działa poprawnie. Na to wygląda że pole file nie przyjmuje mojego dekoratora

Cały kod
  1.  
  2. $this->setAction('')->setMethod('post');
  3. $this->setAttrib('enctype', 'multipart/form-data');
  4. $this->setName('select');
  5.  
  6. # Tworzenie pola title
  7. $this->addElement('file', 'photo', array(
  8. 'label' => 'Zdjęcie',
  9. ));
  10. # End
  11.  
  12. # Tworzenie przycisków
  13. $this->addElement('submit', 'save', array(
  14. 'value' => 'Zapisz',
  15. ));
  16. # End
  17.  
  18. // dekoratory - działa tylko gdy w formularzu nie mam pól typu file
  19. $this->clearDecorators();
  20. $this->addDecorator('FormElements')
  21. ->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'form'))
  22. ->addDecorator('Form');
  23.  
  24. $this->setElementDecorators(array(
  25. array('ViewHelper'),
  26. array('Errors', array('tag' => 'div', 'class' => 'element-errors')),
  27. array('Label', array('tag' => 'div', 'class' => 'element-label')),
  28. array('HtmlTag', array('tag' => 'div', 'class' => 'element-group'))
  29. ));
  30.  
  31.  
  32. return $this;


Jak w takim razie udekorować pole typu file ?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 21:32