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
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:287220
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to