{"action":"created","issue":{"url":"https://api.github.com/repos/snapshotpl/ZfSnapJquery/issues/4","labels_url":"https://api.github.com/repos/snapshotpl/ZfSnapJquery/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/snapshotpl/ZfSnapJquery/issues/4/comments","events_url":"https://api.github.com/repos/snapshotpl/ZfSnapJquery/issues/4/events","html_url":"https://github.com/snapshotpl/ZfSnapJquery/issues/4","id":34945226,"number":4,"title":"Add docs for callback usage on autocompleter","user":{"login":"webdevilopers","id":3479626,"avatar_url":"https://avatars.githubusercontent.com/u/3479626?v=3","gravatar_id":"","url":"https://api.github.com/users/webdevilopers","html_url":"https://github.com/webdevilopers","followers_url":"https://api.github.com/users/webdevilopers/followers","following_url":"https://api.github.com/users/webdevilopers/following{/other_user}","gists_url":"https://api.github.com/users/webdevilopers/gists{/gist_id}","starred_url":"https://api.github.com/users/webdevilopers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webdevilopers/subscriptions","organizations_url":"https://api.github.com/users/webdevilopers/orgs","repos_url":"https://api.github.com/users/webdevilopers/repos","events_url":"https://api.github.com/users/webdevilopers/events{/privacy}","received_events_url":"https://api.github.com/users/webdevilopers/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-06-04T10:00:35Z","updated_at":"2015-01-28T10:24:45Z","closed_at":"2015-01-28T10:24:45Z","body":"Currently the Autocompleter form element escapes every `jquery` `attribute`.\r\nWhile this is fine for default valus like `minLength` it makes callback functions unusable:\r\n\r\n```php\r\n        $this->add(array(\r\n            'name' => 'supplierBranchContactAutoComplete',\r\n        \t'type' => 'Autocomplete',\r\n        \t'options' => array(\r\n        \t\t'label' => 'Contact'\r\n        \t),\r\n            'attributes' => array(\r\n            \t'id' => 'contact_supplier_branch_auto_complete',\r\n            \t'class' => 'form-control auto_complete important',\r\n\t\t        'jquery' => array(\r\n\t\t            'source' => '/branch/autoCompleteForBranchLongName', // @todo Add url view helper\r\n\t\t            'minLength' => 2,\r\n\t\t        \t#'focus' => 'autocompleteFocus'\r\n\t\t        \t'focus' => 'function( event, ui ) {\t$( this ).val( \"foo\" );\treturn false; };'\r\n\t\t        ),\r\n            ),\r\n\t\t));\r\n```\r\n\r\nThis will result in:\r\n```javascript\r\n$(\"#contact_supplier_branch_auto_complete\").autocomplete({\"source\":\"\\/branch\\/autoCompleteForBranchLongName\",\"minLength\":2,\"focus\":\"function( event, ui ) {\\t$( this ).val( \\u0022foo\\u0022 );\\treturn false; };\"});\r\n```\r\n\r\nA possible workaround would be adding callbacks like `focus`, `search`, `select` and `change` as events manually. But since the purpose of this module obviously is automatic JS code generation this would be a great enhancement.\r\n\r\nBefore starting development we should take a look at other modules handle jQuery functions e.g. `ZfcDatagrid` see issue https://github.com/ThaDafinser/ZfcDatagrid/issues/95."},"comment":{"url":"https://api.github.com/repos/snapshotpl/ZfSnapJquery/issues/comments/71811585","html_url":"https://github.com/snapshotpl/ZfSnapJquery/issues/4#issuecomment-71811585","issue_url":"https://api.github.com/repos/snapshotpl/ZfSnapJquery/issues/4","id":71811585,"user":{"login":"webdevilopers","id":3479626,"avatar_url":"https://avatars.githubusercontent.com/u/3479626?v=3","gravatar_id":"","url":"https://api.github.com/users/webdevilopers","html_url":"https://github.com/webdevilopers","followers_url":"https://api.github.com/users/webdevilopers/followers","following_url":"https://api.github.com/users/webdevilopers/following{/other_user}","gists_url":"https://api.github.com/users/webdevilopers/gists{/gist_id}","starred_url":"https://api.github.com/users/webdevilopers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webdevilopers/subscriptions","organizations_url":"https://api.github.com/users/webdevilopers/orgs","repos_url":"https://api.github.com/users/webdevilopers/repos","events_url":"https://api.github.com/users/webdevilopers/events{/privacy}","received_events_url":"https://api.github.com/users/webdevilopers/received_events","type":"User","site_admin":false},"created_at":"2015-01-28T10:24:45Z","updated_at":"2015-01-28T10:24:45Z","body":"I must confess that I'm no longer working on the project with this module.\r\nBut I added my examples. I hope they look ok. Maybe you should check the functionality again.\r\n\r\nMaybe you should create single files in a docs folder for installation, autocomplete etc. @snapshotpl ."}}