gpt4 book ai didi

javascript - 将表单中的输入传递到 Coldfusion Query

转载 作者:行者123 更新时间:2023-12-03 01:02:41 26 4
gpt4 key购买 nike

您好,我正在尝试传递一个变量,该变量的值来自表单输入到查询以检索值并将其作为隐藏值传递回表单。非常令人困惑,我希望我想得太多了。我收到 Passed_Lot_Number is undefined 错误。

这是我到目前为止的代码:

<CFOUTPUT>
<cfquery name = "OutputDetails" datasource = "#Application.PrimaryDataSource#">
SELECT ShippingAdviceID
FROM ShippingAdvice
WHERE CustomerID = #Passed_CustomerID#
AND LotNumber = #Passed_Lot_Number#
</cfquery>
<td align="left" colspan="1">
<input class="frm3" type="text" id="Outstanding_Passed_LotNumber" size="3" maxlength="6" tabindex="25">
<form name="Show_SampleLogSheet" class="frm" action="/Buying/Shipping_Advice/Index.cfm" method="post">
<input type="hidden" name="Passed_CustomerID" value="#Passed_CustomerID#">
<input class="frm3" type="text" name="Passed_Lot_Number" size="3" maxlength="6" tabindex="25">
</form>
</td>
</CFOUTPUT>

请原谅,这段代码确实很旧,我的任务是为其添加更多功能。我真的很感谢任何帮助。

谢谢

编辑:

这里是一些更新的代码:

<CFOUTPUT>
<td align="left" colspan="1">
<input class="frm3" type="text" id="Outstanding_Passed_LotNumber" size="3" maxlength="6" tabindex="25" style="background-color: ##838383;border:1px solid ##000000; color:white">
<form name="Show_SampleLogSheet" class="frm" action="/Buying/Shipping_Advice/Index.cfm" method="post" style="display: inline">
<input type="hidden" name="Passed_CustomerID" value="#Passed_CustomerID#">
<input class="frm3" type="text" name="Passed_Lot_Number" size="3" maxlength="6" tabindex="25">
<cfif structKeyExists(form, "Passed_Lot_Number ")>
<cfquery name = "OutputDetails" datasource = "#Application.PrimaryDataSource#">
SELECT ShippingAdviceID
FROM tblShippingAdvice
WHERE CustomerID = #Passed_CustomerID#
AND LotNumber = #Passed_Lot_Number#
<cfreturn Passed_ShippingAdviceID />
</cfquery>
</cfif>
<input type="hidden" name="Passed_ShippingAdviceID" value="#Passed_ShippingAdviceID#">
</form>
</td>
</CFOUTPUT>

最佳答案

所以我终于解决了这个问题。原来我在这个问题上的想法是错误的。在处理某事之前了解数据流的另一个完美示例。结果一共有3个页面传递了数据。它来自客户端 -> 界面页面 -> 显示结果。表单提交到Interface Page,然后我刚刚添加了定义Passed_ShippingAdviceID 变量的逻辑。这是更新后的表单代码:

<td align="left" colspan="1">
<input class="frm3" type="text" id="Outstanding_Passed_LotNumber" size="3" maxlength="6" tabindex="25" style="background-color: ##838383;border:1px solid ##000000; color:white">
<form name="Show_SampleLogSheet" class="frm" action="/Interface Page" method="post" style="display: inline">
<input type="hidden" name="Passed_CustomerID" value="#Passed_CustomerID#">
<input class="frm3" type="text" name="Passed_Lot_Number" size="3" maxlength="6" tabindex="25">
<input type="hidden" value="1" name="Passed_Activate">
<input type="hidden" value ="" name = "Passed_ShippingAdviceID">
</form>
</td>

这是定义Passed_ShippingAdviceID的界面页面上的查询:

<cfif Passed_ShippingAdviceID IS "">
<cfquery name = "OutputDetails" datasource = "#Application.PrimaryDataSource#">
SELECT ShippingAdviceID
FROM tblShippingAdvice
WHERE CustomerID = '#Passed_CustomerID#'
AND LotNumber = '#Passed_Lot_Number#'
</cfquery>
<cfset Passed_ShippingAdviceID = OutputDetails.ShippingAdviceID>
</cfif>

关于javascript - 将表单中的输入传递到 Coldfusion Query,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52558169/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com