Are you saying you want the lookup to happen when the user tabs out of
the form field? That is not _directly_ possible in CF. Remember that
CF is server side. it knows nothing about what you are doing with your
browser. You _can_ do this with technologies like AJAX.
Is that what you had meant?
On 4/27/07, Allison Watson <[EMAIL PROTECTED]> wrote:
> I am very new at this Cold Fusion thing so bare with me. I would like to be
> able to be able to populate the account name field after the user inputs the
> account number. This would require that after the user inputs the account
> number and gets out of that text box a query would run that would use that
> account number entered as a parameter in the query "AcctLookUp" to kick back
> the account name. I just have no idea how to do that. Please help. Here is
> the code I have so far, and I apologize in advance for how ugly you probably
> think it is. Thanks,Allison
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <cfsetting showdebugoutput="yes">
>
> <cfquery name = "ReferenceCnt" datasource="FINANCE_ADJUSTMENTS">
> select max(reference_no) as reference_no
> from tbl_Request_Form
> </cfquery>
>
> <!---Set variables returned by reference count query--->
> <cfset session.ReferenceNo=#ReferenceCnt.reference_no#>
>
> <cfquery name = "AcctLookUp" datasource="FINANCE_REV_TERADATA">
> SELECT
> A.ACCT_NBR AS ACCT_NBR,
> A.BILL_RCPN_NAME AS ACCT_NAME
> FROM ARMDVP00.ARMUV002 A
> WHERE A.ACCT_NBR=#FORM.ACCT_NBR#
> GROUP BY
> A.BILL_RCPN_NAME,
> A.ACCT_NBR
> </cfquery>
>
> <html>
>
> <head>
> <title>UP: RAD Adjustments Database</title>
>
> <!--- Initialize RICOLA Global Elements --->
> <CF_SSI VIRTUAL="/ssi/apps/headwhite.txt">
> <CF_SSI VIRTUAL="/ssi/apps/groupbox/groupbox.txt">
> <CF_SSI VIRTUAL="/ssi/apps/required/required.txt">
>
> <!---VALIDATING WHEN USER SUBMITS FORM--->
> <SCRIPT LANGUAGE="JavaScript">
> function isEmpty(str) {
> // Check whether string is empty.
> for (var intLoop = 0; intLoop < str.length; intLoop++)
> if (" " != str.charAt(intLoop))
> return false;
> return true;
> }
>
> function checkRequired(f) {
> var strError = "";
> for (var intLoop = 0; intLoop<f.elements.length; intLoop++)
> if (null!=f.elements[intLoop].getAttribute("required"))
> if (isEmpty(f.elements[intLoop].value))
> strError += " " + f.elements[intLoop].name + "\n";
> if ("" != strError) {
> alert("Required data is missing:\n" + strError);
> return false;
> }
> }
> </SCRIPT>
>
>
> </head>
>
> <body>
> <!--- Initialize RICOLA Menubar --->
>
> <CF_SSI VIRTUAL="/ssi/apps/header.txt">
> PageTitle("New Request Form",1);
>
> SubMenusControlHide();
> ReturnTo("Up Employee Home","/emp/");
> ReturnTo("Finance","/emp/finance/");
>
> AppName("Revenue Adjustments Database (RAD)","index.shtml");
>
> MenuOptions("New Request Form","New_Request.cfm","0")
> SubMenuOptions("2","Sub Menu Option A","#","1");
> SubMenuOptions("2","Sub Menu Option B","#","0");
> SubMenuOptions("2","Sub Menu Option C","#","1");
> SubMenuOptions("2","-","#","4");
> SubMenuOptions("2","Sub Menu Option D","#","1");
>
> Splash();
> // -->
> </SCRIPT>
>
> <form action="GetAcctName.cfm" method="post" ONSUBMIT="RETURN
> CHECKREQUIRED(THIS);">
> <TABLE border="0" width="100%" height="70">
> <THEAD>
> <TH ROWSPAN=2 align="left">Account Nbr</TH>
> <TH ROWSPAN=2 align="left">Account Name</TH>
> <TH ROWSPAN=2 align="left">Freight Bill No(s)*</TH>
> <TH ROWSPAN=2 align="left">Adjustment Amt</TH>
> <TH ROWSPAN=4 align="left" width=>Adjustment Code</TH>
> <TH ROWSPAN=2 align="left">Reason For Adjustment</TH>
> </THEAD>
> <TBODY>
> <TR>
> <TD valign="top"><input type="text" name="AcctNbr" size="15" maxlength="20"
> REQUIRED> </TD> <!---Acct Nbr--->
>
> <TD valign="top"><input type="text" name="AcctName" REQUIRED> </TD>
> <!---Acct Name--->
>
>
> <TD valign="top"><textArea name="FreightBills" REQUIRED
> style="text-valign:bottom" cols="10" rows="1" wrap="virtual"
> align="bottom"></textarea> </TD> <!---Freight Bills--->
> <TD valign="top"><textArea name="AdjustmentAmt" REQUIRED
> style="text-valign:bottom" cols="15" rows="1" wrap="virtual"
> align="bottom"></textarea> </TD> <!---Adjustment Amt--->
> <TD valign="top"><select name="AdjustCd" REQUIRED> <option
> value="nothing"><option value="M&SWaver">M&S Waver<option
> value="GerneralWO">General WO</select></TD>
> <TD valign="top"><textArea name="Reason" REQUIRED style="text-valign:bottom"
> cols="20" rows="1" wrap="virtual" align="bottom"></textarea></TD>
>
> </TR>
>
> </TBODY>
> </TABLE>
> <input type = "reset" name="ResetForm" value="Clear Form">
> <input type = "submit" name="SubmitForm" value="Submit">
> </FORM>
>
> <Table>
> <cfloop query="ReferenceCnt"><cfoutput>
> <TD ROWSPAN=2><big>Reference Number:</big></TH>
> <TD CLASS="txtsv" align="right" valign="bottom"><big>#"REF" &
> Reference_No+1#</big></TD>
>
> <TD ROWSPAN=2><big> </big></TH>
>
> <TD ROWSPAN=2><big>Date Requested:</big></TD>
> <TD CLASS="txtsv" align="right" valign="botton"><big>#dateformat(now(),
> "mm/dd/yy")#</big></TD>
>
> <TD ROWSPAN=2><big> </big></TH>
>
> <TD ROWSPAN=2><big>Requestor Name:</big></TH>
>
> </cfoutput></cfloop>
> </TABLE>
> <BR>
> <BR>
> <cfoutput>*If entering multiple freight bills, adjustment amounts must
> correspond to the order of the freight bills.</cfoutput>
>
> <CF_SSI VIRTUAL="/ssi/apps/footer.txt">
>
> </body>
> </html>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR
Archive:
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2727
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15