ColdFusion 8 AJAX from Ben Forta
I found sample codes written by Ben Forta and I want to used it for my application but since it is a bit different, I need to tweak it. Unfortunately it did not work (work partially).
I'm not sure how to call the component when user type in the AmountSent on the input text field so user can automatically get the list of fee in a drop down that is in the range of the amount typed in on thetext field (see below)
Thank you for helping.
On MyForm.cfm:
<!--- This part is working : User typing any amount of money and a list of autosuggest pop up --->
<cfquery name="datafee" datasource="#MyDSN#">
SELECT AmountSent
FROM tblFeeLookUp
ORDER BY FeeID
</cfquery>
Amount To Be SEND:
<cfinput
type="text" name="AmountSent" autosuggest="#ValueList(datafee.AmountSent)#" bindonload="true" class="inputText">
<!--- a drop down fee values associated with the amount typed in the above textbox: This one does not work --->
<!--- This section is calling cfcomponent (see below) --->
Your fee is:
<cfselect
name="MyFee" bind="cfc:FeeTemp.GetThisFees({cfautosuggestvalue})" class="inputText" /> ----> ????
On my component:
<cffunction name="GetThisFees" access="remote" returntype="array">
<!--- Define variables --->
<cfset var datafee="">
<cfset var feeresult=ArrayNew(1)>
<!--- Get transfer fee --->
<cfquery name="datafee" datasource="#THIS.dsn#">
SELECT FeeID,OurFee
FROM TblFeeLookUp
WHERE AmountSent = #ARGUMENTS.AmountSent#
AND ProgramType = 'EKONOMI'
AND AccountType = 'Rp'
ORDER BY FeeID
</cfquery>
<!--- Build result array --->
<cfloop query="datafee">
<cfset ArrayAppend(feeresult, OurFee)>
</cfloop>
<cfreturn feesresult>
</cffunction>
