Mam kod formularza:
  1. [...]
  2. array('File', 'file1', array(
  3. 'destination' => APPLICATION_PATH.'/../public/upload',
  4. 'validators' => array(
  5. array('count', false, 1),
  6. array('size', false, 102400),
  7. ),
  8. 'label' => 'Wyślij plik:'
  9. )),
  10. array('File', 'file2', array(
  11. 'destination' => APPLICATION_PATH.'/../public/upload',
  12. 'validators' => array(
  13. array('count', false, 1),
  14. array('size', false, 102400),
  15. ),
  16. 'label' => 'Wyślij plik:'
  17. )),
  18. array('File', 'file3', array(
  19. 'destination' => APPLICATION_PATH.'/../public/upload',
  20. 'validators' => array(
  21. array('count', false, 1),
  22. array('size', false, 102400),
  23. ),
  24. 'label' => 'Wyślij plik:'
  25. )),
  26. array('File', 'file4', array(
  27. 'destination' => APPLICATION_PATH.'/../public/upload',
  28. 'validators' => array(
  29. array('count', false, 1),
  30. array('size', false, 102400),
  31. ),
  32. 'label' => 'Wyślij plik:'
  33. )),
  34. ));


Do tego dodany dekorator:


  1. $this->setDecorators(array(
  2. array('FormElements', array(
  3. 'class' => 'form'
  4. )),
  5. array('Form', array(
  6. 'class' => 'form'
  7. ))
  8. ));
  9.  
  10. $this
  11. ->setElementDecorators(array(
  12. array('ViewHelper', array(
  13. 'class' => 'input'
  14. )),
  15. 'Label',
  16. array('Description', array(
  17. 'tag' => 'div',
  18. 'class' => 'description',
  19. 'escape' => false,
  20. 'placement'=> 'append'
  21. )),
  22. array('Errors', array(
  23. 'tag' => 'div',
  24. 'class' => 'error'
  25. )),
  26. array('HtmlTag', array(
  27. 'tag' => 'div',
  28. 'class' => 'element'
  29. )),
  30. array('file', array(
  31. 'tag' => 'div',
  32. 'class' => 'element'
  33. ))
  34. ));


Bez dekoratora file dostaję error o braku dekoratora - nie wiem czemu pierwszy raz słyszę o tym dekoratorze, ale jeśli go dodaję to form wygląda tak:

  1. <div class="element">
  2. <label class="optional" for="file1">Wyślij plik:</label>
  3. <input id="file1" type="file" name="file1">
  4. </div>
  5. <input id="MAX_FILE_SIZE" type="hidden" value="104857600" name="MAX_FILE_SIZE">
  6. <input id="file1" class="element" type="file" tag="div" name="file1">
  7. <span class="subtip">Max. file size 30720 Kb.</span>
  8. <p></p>


A wszystkie inne elementy mają error:
Warning: Method getMaxFileSize does not exist in H:\panel\library\Zend\Form\Element.php on line 2061

Więc nie dość że form pokazuje się dwa razy to jeszcze psuje resztę formularza... Jest jakieś inne rozwiązanie niż przeliterowanie całego forma i dodanie mu dekoratora w zależności od typu pola? (input,select,checkbox lub file)