ZF-9951: ZendX_JQuery_Controller_Action_Helper_AutoComplete sets a bad content for the reponse


Consider the following action method used for autocomplete source:

public function getTagsAction() {
        new ZendX_JQuery_Controller_Action_Helper_AutoComplete()
    $this->_helper->autoComplete(array('test', 'testing', 'tester', 'tests', 'i am testing'));

The response of such a call will have each item of the array in its own line (see ZendX_JQuery_Controller_Action_Helper_AutoComplete::prepareAutoCompletion()), where according to the example here: http://jqueryui.com/demos/autocomplete/#remote the response should be a json array of strings, or json array of json objects. For example:

[{'id':'111', 'label':'test'}, {'id':'222', 'label':'testing'}, {'id':'333', 'label':'tester'}, {'id':'444', 'label':'tests'}, {'id':'555', 'label':'i am testing'}]


This is an admittedly hacky attempt at a patch, but it did the job for my simple needs, and could be a good start towards a fuller solution. I'm assuming this had to do with the new version of JQuery/UI.

Following up again:

It appears that this autocomplete works for the JQuery plugin (http://docs.jquery.com/Plugins/Autocomplete), but not for the Autocomplete now bundled with JQuery UI. It might be advisable to either make this an option, either as a new action helper or as a flag put in.