Zendx JQuery Autocomplete
Posted
by emeraldjava
on Stack Overflow
See other posts from Stack Overflow
or by emeraldjava
Published on 2009-07-14T22:45:00Z
Indexed on
2010/04/22
10:23 UTC
Read the original article
Hit count: 478
I've been trying to get the Zend Jquery autocomplete function working, when i noticed this section in the Zend documentation.
The following UI widgets are available as form view helpers. Make sure you use the correct version of jQuery UI library to be able to use them. The Google CDN only offers jQuery UI up to version 1.5.2. Some other components are only available from jQuery UI SVN, since they have been removed from the announced 1.6 release.
autoComplete($id, $value, $params, $attribs): The AutoComplete View helper will be included in a future jQuery UI version (currently only via jQuery SVN) and creates a text field and registeres it to have auto complete functionality. The completion data source has to be given as jQuery related parameters 'url' or 'data' as described in the jQuery UI manual.
Does anybody know which svn url tag or branch i need to download to get a javascript file with the autocomplete functions available in it?
At the moment, my Bootstrap.php has
$view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
$view->jQuery()->enable();
$view->jQuery()->uiEnable();
Zend_Controller_Action_HelperBroker::addHelper(
new ZendX_JQuery_Controller_Action_Helper_AutoComplete()
);
// Add it to the ViewRenderer
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
In my layout, i define the jquery ui version i want
<?php echo $this->jQuery()
->setUiVersion('1.7.2');?>
Finally my index.phtml has the autocomplete widget
<p><?php $data = array('New York', 'Tokyo', 'Berlin', 'London', 'Sydney', 'Bern', 'Boston', 'Baltimore'); ?>
<?php echo $this->autocomplete("ac1", "", array('data' => $data));?></p>
I'm using Zend 1.8.3 atm.
© Stack Overflow or respective owner