i believe you can't with cf's autosuggest implementation... what you can do, is parse the submitted value of the textbox (the whole string returned by your cfc and selected by user) and get the id from it. with the string format you posted trim(listlast(form.client)) should get you the id on the form's action page...
Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ On 06/10/2009 21:49, Adam Parker wrote: > Hello - > > > > I'm attempting to use my first CFC in conjunction with cfinput and > autosuggest. As is currently, everything works as far as the autosuggestion > goes. My simple form is this: > > > > <cfform action="#cgi.SCRIPT_NAME#"> > > Client: <cfinput type="text" > > name="client" > > > autosuggest="cfc:client.lookupClient({cfautosuggestvalue})" size="90"> > > <br /> > > <input type="submit" value="Save"> > > </cfform> > > > > > > My CFC is: > > > > <cfcomponent output="false"> > > <cfset THIS.dsn="myDSN"> > > <!--- Lookup used for auto suggest ---> > > <cffunction name="lookupClient" access="remote" returntype="array"> > > <cfargument name="search" type="any" required="false" default=""> > > <!--- Define variables ---> > > <cfset var data=""> > > <cfset var result=ArrayNew(1)> > > <!--- Do search ---> > > <cfquery datasource="#THIS.dsn#" name="data"> > > SELECT clientID,firstName,lastName,email,organization FROM client > > WHERE UCase(lastname) LIKE Ucase('#ARGUMENTS.search#%') > > ORDER by lastname, firstname > > </cfquery> > > <!--- Build result array ---> > > <cfloop query="data"> > > <cfset name = '#lastname#, #firstname# (#email# - #organization#), > #clientID#'> > > <cfset ArrayAppend(result, #name#)> > > </cfloop> > > <!--- And return it ---> > > <cfreturn result> > > </cffunction> > > </cfcomponent> > > > > The data returns to the textbox formatted how I want it to be; however, when > the form submits, I only want the ID to post to the record. How may I > obtain the ID from the CFC to use it in a hidden field of the form so the > associated ID of the client posts to the database record? > > > > Thank you > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326961 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4