views:

91

answers:

1

Hey,

I'm setting up my first ZendX_JQuery_Form. In my controller, I've got the following code:

$form = new ZendX_JQuery_Form ();

$date1 = new ZendX_JQuery_Form_Element_DatePicker ( 'date1', array ('label' => 'Date:' ) ); $form->addElement ( $date1 );

$elem = new ZendX_JQuery_Form_Element_AutoComplete( 'ac1', array('label' => 'Autocomplete:')); $elem->setJQueryParams(array('source' => array('New York','Berlin','Bern','Boston'))); $form->addElement($elem); $this->view->form = $form;

And I'm including the required code in my Boostrap:

$view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper");

So the DatePicker is working perfect. But the AutoComplete field is just a plain text box, nothing showing up. And I can't figure out why.

Viewing the source, jQuery is being included ok (obviously is because the DatePicker works) and the events have been set up :

$(document).ready(function() {

$("#date1").datepicker({});
$("#ac1").autocomplete({"source":["New York","Berlin","Bern","Boston"]});

});

This is in the header:

<script type="text/javascript" src="/js/jquery/js/jquery-1.4.2.min.js"></script>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"&gt;&lt;/script&gt;

And the correct field is there:

<input type="text" name="ac1" id="ac1" value="" />

I'm dumbfounded! Please help.

A: 

Just realised that the code library for jquery ui that was automatically included (from Google code libraries) didn't have the autocomplete function. You need to manually set the localPath:

$this->jQuery ()->setUiLocalPath('/js/jquery/js/jquery-ui-1.8.2.custom.min.js');
Mark