FYI, I got this to work. Here is the code that I ended up with. Perhaps it will help others who run across the same problem:
jQuery("#pocEmail").autocomplete("../screen/PersonLookup", { width: 275, minChars: 1, cacheLength: 25, selectFirst: false, max: 50, dataType: "json", extraParams: {field2Use:'email',output:'json'}, //formatMatch: formatPocMatch, //formatResult: formatPocResult, parse: parsePocJSON, formatItem: formatPocItem }); jQuery("#pocEmail").result(formatPocResult); function parsePocJSON(data) { var json = data.persons.person; var parsed = []; if(json != undefined) { //There are some matches if(json.length != undefined) { //There are multiple records for (var i=0; i < json.length; i++) { var row = json[i]; parsed.push({ data: row, value: row["email__"], result: row["email__"] }); } }else{ //There is a single record parsed.push({ data: data.persons.person, value: data.persons.person.email__, result: data.persons.person.email__ }); } } return parsed; } function formatPocItem(row) { return row["firstName__"] + ' ' + row["lastName__"] + ' [' + row["email__"] + ']'; } function formatPocResult(event, row, formatted) { jQuery("#pocEmail").val(row["email__"]); jQuery("#pocFname").val(row["firstName__"]); jQuery("#pocLname").val(row["lastName__"]); } On Feb 5, 3:42 pm, zendog74 <n8cs...@gmail.com> wrote: > I managed to alias some of the classes to more simple names in my WS, > so myJSONnow looks like this. > > {"persons": > {"person":[ > {"personId__": > 6,"firstName__":"Jack","lastName__":"Black","email__":"jbl...@jackblack.com"}, > {"personId__": > 1,"firstName__":"Joe","lastName__":"Blow","email__":"jb...@hotmail.com"}, > {"personId__": > 4,"firstName__":"Jason","lastName__":"Giambi","email__":"jgia...@yahoo.com"}, > {"personId__": > 3,"firstName__":"Jim","lastName__":"Jones","email__":"jjo...@hotmail.com"}, > {"personId__": > 5,"firstName__":"Jill","lastName__":"Robin","email__":"jro...@gmail.com"}, > {"personId__": > 2,"firstName__":"Jason","lastName__":"Smith","email__":"jsm...@hq.nasa.gov"} > ]} > > } > > I am still working on getting it parsed properly by overriding the > parse function inautocomplete, but I don't have it working yet. Any > assistance is appreciated! > > jQuery("#pocEmail").autocomplete("../screen/PersonLookup", { > width: 260, > minChars: 1, > cacheLength: 20, > selectFirst: false, > max: 25, > dataType: "json", > extraParams: {field2Use:'email',output:'json'}, > //formatResult: formatResult, > //formatItem: formatItem, > //formatMatch: formatMatch > parse: autocompleteJSON, > formatItem: function(row) { > return row["email__"]; > //return row.firstName__ + " " + row.lastName__ + "[" > + row.email + "]"; > } > }); > }); > > var autocompleteJSON = function(data) { > varjson= data.persons.person; > var parsed = []; > for (var i=0; i <json.length; i++) { > var row =json[i]; > parsed.push({ > data: row, > value: row["firstName__"] + ' ' + row["lastName__"] + > ' [' + row["email__"] + ']', > result: row["email"] > }); > } > return parsed; > }; > > On Feb 5, 10:32 am, zendog74 <n8cs...@gmail.com> wrote: > > > What is the status of using remoteJSONwith jquery.autocomplete? I > > saw a couple of threads in the group about it, but they are patchworky > > and hard to follow. I did not see anything about usingJSONon the > >autocompletejquery plugin site. Is using remoteJSONsupported or do > > I have to modify source to make it work? > > > Here is what I am trying to do. I created a WS to return some user > > data for anautocomplete. Here is theJSONthat is returned when I > > type 'j' into myautocompleteform field. > > > {"linked-list":{"gov.nasa.hq.portal.calendar.to.PersonTO": > > [{"personId__": > > 6,"firstName__":"Jack","lastName__":"Black","email__":"jbl...@jackblack.com"}, > > {"personId__": > > 1,"firstName__":"Joe","lastName__":"Blow","email__":"jb...@hotmail.com"}, > > {"personId__": > > 4,"firstName__":"Jason","lastName__":"Giambi","email__":"jgia...@yahoo.com"}, > > {"personId__": > > 3,"firstName__":"Jim","lastName__":"Jones","email__":"jjo...@hotmail.com"}, > > {"personId__": > > 5,"firstName__":"Jill","lastName__":"Robin","email__":"jro...@gmail.com"}, > > {"personId__": > > 2,"firstName__":"Jason","lastName__":"Smith","email__":"jsm...@hq.nasa.gov"}]}} > > > Here is my javascript: > > > document.observe("dom:loaded", function() { > > > jQuery("#pocEmail").autocomplete("../screen/PersonLookup", { > > width: 260, > > minChars: 1, > > cacheLength: 20, > > selectFirst: false, > > max: 25, > > extraParams: {field2Use:'email',output:'json'}, > > formatItem: function(row, i, max) { > > alert(row); > > return row; > > //return row.firstName__ + " " + row.lastName__ + "[" > > + row.email + "]"; > > } > > }); > > > }); > > > The entireJSONis getting returned as a row, so I assume it is being > > treated as a String and is seen as one row. > > > Can I make this work without too much hardship? The WS I created can > > return XML as well if that is an option. > > > Thanks!