Salut à tous,

J'ai un léger soucis avec un autocomplete Zend_X_jQuery ('id_city'). Il marche tres bien hors d'un formulaire, tout se passe bien. Ensuite, j'ai voulu le rajouter à mon formulaire.

Il semble qu'il y ai un soucis avec les décorateurs. Voici l'erreur, et le code qui suit.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
Warning: Exception caught by form: Cannot render jQuery form element without at least one decorator implementing the 'ZendX_JQuery_Form_Decorator_UiWidgetElementMarker' interface. Default decorator for this marker interface is the 'ZendX_JQuery_Form_Decorator_UiWidgetElement'. Hint: The ViewHelper decorator does not render jQuery elements correctly. Stack Trace: #0 C:\Users\FP\web\librairies\zend\library\Zend\Form\Element.php(2029): ZendX_JQuery_Form_Element_UiWidget->getDecorators() #1 C:\Users\FP\web\librairies\zend\library\Zend\Form\Decorator\FormElements.php(101): Zend_Form_Element->render() #2 C:\Users\FP\web\librairies\zend\library\Zend\Form.php(2904): Zend_Form_Decorator_FormElements->render('') #3 C:\Users\FP\web\librairies\zend\library\Zend\Form.php(2920): Zend_Form->render() #4 C:\Users\FP\web\wamp\www\my-websites\familife\trunk\web\www\application\modules\backoffice\views\scripts\agency\edit.phtml(4):
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
...
$elements['first_name'] = new Zend_Form_Element_Text('first_name');
        $elements['first_name']->setLabel('Prénom : ')
        ->setRequired(true)
        ->addFilter('StripTags')
        ->addFilter('StringTrim')
		->addValidator('notEmpty')
		->getValidator('notEmpty')->setMessage('msg agency must first name');
 
$elements['id_city']= new ZendX_JQuery_Form_Element_AutoComplete('ac');
		$elements['id_city']->setLabel('Ville ')
		->setJQueryParam('source', '/backoffice/agency/autocompleteajaxcity')
		->setJQueryParam('minLength', $this->_config->autocomplete->max_cars);
...
Les décorateurs :
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
 /////////////////////////////////////////////////////////////////////////////////////////
 // DECORATORS ///////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////////////////
 
        $this->setElementDecorators(array( 
            'ViewHelper',
         	//array('Errors', array('class' => 'formErrors', 'placement' => 'prepend')),            
            array(array('data' => 'HtmlTag'),  array('tag' =>'td', 'class'=> 'element')),
            array('Label', array('tag' => 'td')),
            array(array('row' => 'HtmlTag'), array('tag' => 'tr'))
        ));
 
        $elements['submit']->setDecorators(array('ViewHelper',
            array(array('data' => 'HtmlTag'),  array('tag' =>'td', 'class'=> 'element')),
            array(array('emptyrow' => 'HtmlTag'),  array('tag' =>'td', 'class'=> 'element', 'placement' => 'PREPEND')),
            array(array('row' => 'HtmlTag'), array('tag' => 'tr'))
            ));
 
        $this->setDecorators(array(
            array('FormErrors', array('label'=>'')),       	
            'FormElements',            
            array('HtmlTag', array('tag' => 'table', 'class'=> 'table_edit')),
            'Form'           
        ));
J'ai bien cherché sur le net, mais sans grand succès :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
	public static $formJQueryElements = array(
        array('UiWidgetElement', array('tag' => '')), // it necessary to include for jquery elements
        array('Errors'),
        array('Description', array('tag' => 'span')),
        array('HtmlTag', array('tag' => 'td')),
        array('Label', array('tag' => 'td', 'class' =>'element')),
        array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
        );
Une idée ?
Merci

Fabrice