Bonjour,

j'ai un probleme avec les éléments textarea et validationtexbox de mon formulaire.

Catchable fatal error: Argument 4 passed to Zend_Dojo_View_Helper_ValidationTextBox::validationTextBox() must be of the type array, null given in /var/www/gnosis/library/Zend/Dojo/View/Helper/ValidationTextBox.php on line 64
Est-ce que quelqu'un peut m'aider ?

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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php
 
class Default_Form_Course extends Zend_Dojo_Form
{
    public function init()
    {
        // Set the method for the form to POST
        $this->setDescription("Course saving form")
    		 ->setEnctype(Zend_Dojo_Form::ENCTYPE_URLENCODED)
    		 ->setName("couse_form")
    		 ->setAction('course')
             ->setMethod('post');
 
        // for translation
        //$translate = Zend_Registry::get('translate');
 
        ////////////////////////////
        // course elements        //
        ////////////////////////////
 
    	// Add a save button
        $this->addElement('submit', 'course_submit', array(
										            'ignore'   	=> true,
										            'label' 	=> 'Save',
        											'class'		=> 'static')
				        );
 
        // And finally add some CSRF protection
        $this->addElement('hash', 'course_csrf', array(
									            'ignore' => true
									       		 )
						);
 
 
    	// Add a course name element
        $this->addElement('validationTextBox', 'course_name', array(
									            'label'      => 'Course name :',
									            'required'   => true,
									            'filters'    => array('StripTags',
									            					'StringTrim'),
        										'regExp'         => '^[\sa-zA-Z0-9_-]{6,60}$',
									        	//'ErrorMessages' => array('required'=> '$translate->_("Ce champs est vide : vous devez le compléter")'),
        										//'invalidMessage' => 'Invalid course name must be between 6 and 60 alphanumeric characters',
									        	'promptMessage'	=> 'Enter your course name',
									        	'id'			=> 'course_name',
        										'class'			=> 'static'
									       		 )
       					 );
 
		// Add a Course about element
        $this->addElement('Textarea', 'course_about', array(
									            'label'      => 'Short description :',
									            'required'   => true,
									            'filters'    => array('StripTags',
									            						'StringTrim',),
									            'validators' => array(array('StringLength', false, array(0, 250))),
									        	//'ErrorMessages' => array('more'=>'Element requis'),
        										'invalidMessage' => 'Description must be under 250 characters',
        										 'promptMessage'	=> 'Describe the course',
									        	'id'			=> 'course_about',
        										'class'			=> 'static'
									       		 )
       					 );
 
       	// Add a Course update type element
        $this->addElement('ComboBox', 'course_update_type', array(
									            'label'      => 'Type of edition :',
									            'required'   => true,
									            'value'        => 'original',
												'autocomplete' => true,
												'multiOptions' => array('original'    => '$translate->_("Original")',
																		'normal'    => '$translate->_("Update")',
																		'minor'   => '$translate->_("Minor update")',),
									        	'ErrorMessages' => array('required'=>'Element requis'),
									        	'promptMessage'	=> 'Enter gender',
									        	'id'			=> 'course_update_type',
        										'class'			=> 'static',
        										'invalidMessage' => 'Invalid type',
        									       		 )
       					 );
 
		// Add a Course update comment element
        $this->addElement('Textarea', 'course_update_comment', array(
									            'label'      => 'Comment the modification :',
									            'required'   => true,
									            'filters'    => array('StripTags',
									            						'StringTrim',),
									            //'validators' => array(array('StringLength', false, array(0, 250)),),
									        	//'ErrorMessages' => array('more'=>'Element requis'),
        										'invalidMessage' => 'Description must be under 250 characters',
        										 'promptMessage'	=> 'Explain the work just done',
									        	'id'			=> 'course_update_comment',
        										'class'			=> 'static'
									       		 )
       					 );
 
		// Add a term of service agreement
		$this->addElement('checkbox', 'course_agreement', array(
											            'label'      => 'Check this box to accept the terms of service :',
											            'required'   => true,
														'ErrorMessages' => array('required'=>'Element requis'),
											        	'promptMessage'	=> 'Check this box to accept the terms of service',
											        	'id'			=> 'course_agreement_term',
														'class'			=> 'static',
														'uncheckedValue' => ""
											        )
						 );
 
        // Add a captcha element
        $this->addElement('captcha', 'course_captcha', array(
											            'label'      => '5 letters displayed :',
											        	'promptMessage'	=> 'Enter the captcha below to prouve you are an human',
											        	'class'			=> 'static',
        												'filters'    => array('StripTags',
									            						'StringTrim'),
											            'required'   => true,
											           'captcha'    => array(
																                'captcha' => 'Image', 
																                'wordLen' => 2, 
																                'timeout' => 300,
																        		'width'	  => 106,
																        		'height'  => 35,
																		        'dotNoiseLevel' => 30,
																		        'lineNoiseLevel' => 3,
																		        'font' => APPLICATION_PATH . '/../public/fonts/arial.ttf',
																		        'fontSize' => 20,
																		        'imgDir' => APPLICATION_PATH . '/../public/img/captcha/',
																		        'imgUrl' => Zend_Controller_Front::getInstance()->getBaseUrl() . '/img/captcha/',
																            )
       												 )
    				   );
    	// Add a hidden course content element
        $this->addElement('hidden', 'course_content', array(
									            'required'   => true,
									            //'filters'    => array('StripTags'),
									        	//'ErrorMessages' => array('required'=> '$translate->_("Ce champs est vide : vous devez le compléter")'),
        										//'invalidMessage' => 'Invalid course content must be at least 100 caracters',
									        	'id'			=> 'course_content',
        										'class'			=> 'static'
									       		 )
       					 );
 
       	// Add a hidden category id
        $this->addElement('hidden', 'course_category_id', array(
									            'required'   => true,
        										'validators' => array('Digits'),
									            //'filters'    => array('StripTags'),
									        	//'ErrorMessages' => array('required'=> '$translate->_("Ce champs est vide : vous devez le compléter")'),
        										//'invalidMessage' => 'Invalid course content must be at least 100 caracters',
									        	'id'			=> 'course_category_id',
        										'class'			=> 'static'
									       		 )
       					 );
 
/*#######################################*/ 					  
/*###### Here comes the decorators ######*/
/*#######################################*/
 
 
    	/*Set form Decorators*/
        $this->setDecorators(array(
		        					array('FormElements'),
		        					array('HtmlTag', array('tag' => 'div','class' => 'static')),
		              				array('Form')
		              				)
        					);					                        	
 
		/*Set form commons elements Decorators*/					                        	
		$this->setElementDecorators(array(
										array('ViewHelper'),
		                         		),
		                         	null,
		                         	null
		                         );
    }
}