Bonjour,

J'ai crée un formulaire avec un seul Zend_Form_Element_File.

Mais lors de l'affichage, il en apparaît 2. Pourquoi ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
 
public function init()
    {
		$this->setName('formactualite');
 
        $this->setAttrib("style", "width:80%");
		$this->setAttrib('enctype', 'multipart/form-data');
 
		$decorators = array(
            'ViewHelper',
            'Errors',
            array('Description', array('tag' => 'p', 'class' => 'description')),
            array('HtmlTag', array('tag' => 'td', 'align' => 'left')),
            array('Label', array('tag' => 'th')),
            array(array('tr' => 'HtmlTag'), array('tag' => 'tr'))
        );
 
		//Date
		$dateAff = date('d-m-Y');
 
		$date = new Zend_Form_Element_Text('date');
		$date->setLabel('Date')
				->setValue($dateAff)
				->setAttrib('readonly', 'true')
				->addDecorators($decorators);
 
		$usageValidators = array(new Zend_Validate_StringLength(0, 25));
        $titre = new Zend_Form_Element_Text('titre');
        $titre->addFilters(array('StringTrim', 'StringToLower'))
                ->addValidators($usageValidators)
                ->setRequired(true)
                ->setLabel("Titre")
                ->setAttrib("id", "titre")
                ->addDecorators($decorators);
 
 
		$texte = new Zend_Form_Element_Textarea('text');
		$texte->setLabel('Texte')
				->addDecorators($decorators);
 
 
		$image = new Zend_Form_Element_File('image');
		$image->setLabel('Image')
				->addDecorators($decorators)
				->addValidator('Count', false, 1)
				->addValidator('Size', false, 102400)
				->addValidator('Extension', false, 'jpg,png,gif');
 
 
		$usageValidators = array(new Zend_Validate_StringLength(0, 25));
		$legende = new Zend_Form_Element_Text('legende');
		$legende->setLabel('Légende')
				->addValidators($usageValidators)
				->addDecorators($decorators);
 
		$zoom = new Zend_Form_Element_Radio('zoom', array('separator' => ' - '));
		$zoom->setLabel('Zoom')
				->addDecorators($decorators)
				->setMultiOptions(array('1' => ' Oui', '0' => ' Non'));
 
		$submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'boutonenvoyer')
                ->setLabel('Valider')
                ->addDecorators(array(
                                     'ViewHelper',
                                     array(array('td' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)),
                                     array(array('tr' => 'HtmlTag'), array('tag' => 'tr')))
                                );
 
		$this->addElements(array($date, $titre, $texte, $image, $legende, $zoom, $submit));
 
		$this->setDecorators(
            array(
                'FormElements',
                array('HtmlTag', array('tag' => 'table')),
                'Form'
            )
        );
    }
Merci