Actually i don't think that returning a struct would work 'cause the widget itself (aka the cfinput box) doesn't know what to do with that result set. I'll play around with cfajaxproxy - although i'm not sure that it will fix my problem
On 8/27/07, benjamin schwartz <[EMAIL PROTECTED]> wrote: > > Ray you are right and you described exactly what i wanted to do - even the > idea of building a drop down if there are several "johns". > I'm going to look into cfajaxproxy. I want to try what Andy suggest too > though - returning a structure. > > > Any other ideas? > > Thanks already for your help. > > Ben > > On 8/27/07, Raymond Camden <[EMAIL PROTECTED] > wrote: > > > > So if I read you right - what you want is NOT the autosuggest feature > > itself - or actually - you want to do something AFTER the user has > > picked a value. Ie, I type in "Ra", your autocomplete returns a set of > > possibilities, one of which is "Ray", I select Ray, you then load your > > other form fields with info about Ray. > > > > If so - I'd recommend using cfajaxproxy with a bind that points to > > clientName. You can tell ajaxProxy to run a CFC function whenever > > clientName changes, which is what will happen when the user picks one > > of the values you select. > > > > There is a problem with this though. Lets say your autosuggest is > > looking up names in a Contacts table. I type in "J" and get John. > > There could be two Johns in the table. You aren't allowed to return > > complex data, just the string. So if I do the lookup based on John, it > > would only work for one record. > > > > Of course, you could build in support for this as well. I could > > imagine a detail form that would support showing a drop down of all > > the Johns. > > > > So does this help? I could try to whip up a demo later today. > > > > > > On 8/27/07, Ben S <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > > > I'm experimenting with the AJAX stuff that was added with CF 8 and i'm > > running in the following issue - i wonder if anyone played around with it > > and could help me. > > > > > > I have a cfform: > > > <cfform> > > > Client name: <cfinput type="text" name="clientName" > > autosuggest="cfc:company.lookupCompany({cfautosuggestvalue})"> > > > </cfform> > > > > > > and a cfc to populate it with data : > > > > > > <cfcomponent output="false"> > > > <cffunction name="lookupCompany" access="remote" > > returntype="any"> > > > <cfargument name="search" type="any" required="false"> > > > <cfset var data=""> > > > <cfquery datasource="shipping" name="data"> > > > select * from clients where clientName > > like '#ARGUMENTS.search#%' order by clientName > > > </cfquery> > > > <cfreturn data> > > > </cffunction> > > > </cfcomponent> > > > > > > So far nothing spectacular - I actually got this from Ben Forta's > > tutorial. What i would like to do is to add fields in the form and for the > > data to be auto populated if a record for that clientName exists in the > > database. > > > With the current syntax <cfreturn data> i get an error message: > > error:widget: Bind failed for autosuggest clientName, bind value is not a 1D > > array of strings which i don't know how to fix. > > > If i write <cfreturn ValueList( data.clientName)> instead it works > > fine but then i don't know how i would populate other form fields. > > > > > > Any help would be appreciated. > > > > > > Thank you in advance > > > > > > Ben > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Download the latest ColdFusion 8 utilities including Report Builder, plug-ins for Eclipse and Dreamweaver updates. http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:287221 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4