[Seaside] bug in JQAutocomplete JSON encoding

Nick Ager nick.ager at gmail.com
Mon Feb 1 21:45:42 UTC 2010

The JQuery documentation for the new autocomplete widget (
http://docs.jquery.com/UI/Autocomplete), states:

data can be a simple Array of Strings, or it contains Objects for each item
> in the array, with a label or value property or both. The label property is
> displayed in the suggestion menu, the value will be inserted into the input
> element after the user selected something from the menu.

To implement this behaviour I passed a block to
JQAutocomplete>>sourceCallback: which returned an array of Dictionaries
using keys #value and #label. However this didn't work. Eventually I noticed
the Json passed to the client side JQuery wasn't properly formed. The fix is
to change the following line in JQAutocomplete>>sourceCallback:

old version:

self source: ((self jQuery getJson
text: [ :stream | stream javascript: (aOneArgumentBlock value: term) ];

changed version:

self source: ((self jQuery getJson
text: [ :stream | stream json: (aOneArgumentBlock value: term)];

Note this modification makes use of the json fixes and improvements Bart
documented in the mail list:

Once Bart's json fixes go in, I'll check this fix in, unless I hear

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20100201/77b71bda/attachment.htm

More information about the seaside mailing list