Zend Framework

JQuery Autocomplete incorrect parameters

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.7.3
  • Fix Version/s: None
  • Component/s: ZendX_JQuery
  • Labels:
    None

Description

According to the JQuery documentation the AutoComplete plugin needs two parameters (url|data, options). The ZendX_JQuery_View_Helper_AutoComplete autoComplete function encodes the url|data parameter into an array including the options which fails to work once rendered (Tested on Safari and Firefox)

AutoComplete plugin documentation http://docs.jquery.com/Plugins/Autocomplete/autocomplete#url_or_dataoptions

In order to get it to work I had to make the following changes

require_once "Zend/Json.php";
$data = Zend_Json::encode(isset($params['data']) ? $params['data'] : $params['url']);
unset($params['data']);
unset($params['url']);
$params = Zend_Json::encode($params);

$js = sprintf('%s("#%s").autocomplete(%s, %s);',
ZendX_JQuery_View_Helper_JQuery::getJQueryHandler(),
$attribs['id'],
$data,
$params
);

NOTE: Adding to description because I suddenly cannot post Comments.

Plugin is http://docs.jquery.com/Plugins/Autocomplete. I couldn't find reference to the correct plugin in the Zend Framework manual (which is likely explained that is was part of 1.6RC but has now been removed)

Activity

Hide
Benjamin Eberlei added a comment -

which jQuery UI version are you using? They kicked AutoComplete out in the last RC so i can't really support it any more until they stabilized the API and schedulded it for UI 1.7 release.

Show
Benjamin Eberlei added a comment - which jQuery UI version are you using? They kicked AutoComplete out in the last RC so i can't really support it any more until they stabilized the API and schedulded it for UI 1.7 release.
Hide
Benjamin Eberlei added a comment -

Closed issue due to the usage of a jQuery plugin not the original jQuery UI widget.

Show
Benjamin Eberlei added a comment - Closed issue due to the usage of a jQuery plugin not the original jQuery UI widget.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: