Hi,
Sample code before I say anything about the issue..
<cfform >
Name:<cfinput type="text"name="lookup"
autosuggest="cfc:cfcName.getEMPID({cfautosuggestvalue})" ><br />
Department:
<cfselect name="userID" id="userID" bind="cfc:cfcName.getName({lookup})"
display="userID"
value="userID"
bindOnLoad="false" />
</cfform>
cfc code..
<cfcomponent>
<!---function to retun dept based on user name--->
<cffunction name="getName" access="remote" output="false"
returntype="query">
<cfargument name="route_num">
<cfquery name="get_bnk_name" datasource="cfdocexamples">
SELECT emp_id as UserID
FROM Employees
where UCase(FirstName) =Ucase('#ARGUMENTS.route_num#')
</cfquery>
<cfreturn get_bnk_name>
</cffunction>
<!---function to retun emp name based on entered letter--->
<cffunction name="getEMPID" access="remote" output="false"
returntype="string">
<cfargument name="route_num">
<cfquery name="get_bnk_name" datasource="cfdocexamples">
SELECT FirstName,emp_id
FROM Employees
where UCase(FirstName) LIKE Ucase('%#ARGUMENTS.route_num#%')
</cfquery>
<cfreturn ValueList(getEMPID.FirstName)>
</cffunction>
I am using autosugest to display the data in the text field. as started keying
the id and once the id selected..I get name back in the select statement
sucessfully.
I am done with it But my concern is when I key in the id I should get the
dropdownlist in this format id-firstname.
ex: if id is 1
and the repective employer name is daniel then the autosugest dropdown
shoud show 1-Daniel.
I tried using something like this:
<cffunction name="getEMPID" access="remote" output="false" returntype="string">
<cfargument name="route_num">
<cfquery name="get_bnk_name" datasource="cfdocexamples">
SELECT FirstName,emp_id
FROM Employees
where UCase(FirstName) LIKE Ucase('%#ARGUMENTS.route_num#%')
</cfquery>
<cfset arrayName = listtoarray(ValueList(getEMPID.FirstName))>
<cfset arrayemp_id = ListtoArray(ValueList(getEMPID.emp_id))>
<cfset bankname=arraynew(1)>
<cfset empName[i] = listtoarray(arrayName[i] &'-'& arrayemp_id[i])>
<cfreturn empName>
</cffunction>
I would really appreciate with any suggestion.
Thanks,
Priya
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321655
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4