ショッピング カート内のアイテムを削除しようとしたとき。「エレメント ID がフォームで定義されていません」というエラーが表示されます。
どこが間違っていますか?
MSSQL 2008 r2、Coldfusion 10 を使用しています。
概要:
ticket.cfm これは商品を表示するページで、cart_manage.cfm に渡される非表示の値を持つフォームも含まれています。
cart_manage.cfm は、tickets.cfm と cartlist.cfm の両方のアクション ページです。
cartlist.cfm は、ショッピング カートの内容を表示するページです。
application.cfm セッション変数。
アプリケーション.cfm
<cfapplication sessionmanagement="yes">
<cfapplication name="cart" clientmanagement="Yes"
sessionmanagement="Yes"
sessiontimeout="#CreateTimeSpan(0,0,15,0)#"
applicationtimeout="#CreateTimeSpan(0,2,0,0)#">
<cfparam name="session.allowin" default="false">
チケット.cfm
<cfif NOT IsDefined('SESSION.cart')>
<cfset SESSION.cart = ArrayNew(1) />
</cfif>
<cfquery datasource="sqltest" name="getTickets">
select *,
CASE WHEN Friday=1and Saturday=1and Sunday=1
THEN 'All three days'
WHEN Friday=0and Saturday=0and Sunday=0
THEN 'None'
ELSE
STUFF(
case when Friday=1 then ',Friday' else '' end
+ case when Saturday=1 then ',Saturday' else '' end
+ case when Sunday=1 then ',Sunday' else '' end, 1,1,'')
END WhichDays
from tickets_performances;
</cfquery>
<table width="600" border="0">
<tr>
<td>Day</td>
<td>Price</td>
<td>How Many Left</td>
<td>Quantity</td>
</tr>
<p> You can only purchase a maximum of two tickets at a time. Having a ticket limit ensures fairness to all those buying tickets. The ticket limit applies per account, billing address, and/or credit card. Please observe the ticket limit as over purchases may be cancelled without notice or warning. </p>
<cfform action="cart_manage.cfm" name="form" method="post">
<cfoutput query="getTickets">
<tr>
<td>#WhichDays#</td>
<td>£#price#</td>
<td>#stock#</td>
<td><cfinput type="text" id="quantity" name="quantity" size="5" class="field" maxlength="1" value="0"/></td>
<td><cfinput type="hidden" name="id" value="#getTickets.ticket_performanceID#" />
<cfinput type="hidden" name="item" value="#getTickets.WhichDays#" />
<cfinput type="hidden" name="price" value="#getTickets.price#" />
<cfinput type="submit" name="add_button" value="Add to Cart"></td>
</tr>
</cfoutput>
</cfform>
</table>
cart_manage.cfm
<cfset newitem = 0>
<cfloop from="1" to="#arrayLen(session.cart)#" index="i">
<cfif session.cart[i].itemid EQ #form.id#>
<cfset session.cart[i].quantity = session.cart[i].quantity + #form.quantity#>
<cfset newitem = 1>
<cfbreak>
</cfif>
</cfloop>
<cfif newitem EQ 0>
<cfset temp = arrayAppend(session.cart, structNew())>
<cfset session.cart[arrayLen(session.cart)].itemid = #form.id#>
<cfset session.cart[arrayLen(session.cart)].item = #form.item#>
<cfset session.cart[arrayLen(session.cart)].quantity = #form.quantity#>
<cfset session.cart[arrayLen(session.cart)].price = #form.price#>
<cflocation url="cartlist.cfm">
</cfif>
<cfif IsDefined('FORM.delete_button.y')>
<cfloop from="#ListLen(FORM.delete_index)#" to="1" index="i" step="-1">
<cfset ArrayDeleteAt(SESSION.cart, ListGetAt(FORM.delete_index, i))>
</cfloop>
<cflocation url="cartlist.cfm">
<cfelseif IsDefined('FORM.update_button.y')>
<cfloop from="1" to="#ArrayLen(SESSION.cart)#" index="i">
<cfset SESSION.cart[i].quantity = FORM["quantity_" & i] >
</cfloop>
<cflocation url="cartlist.cfm">
<cfelseif IsDefined('FORM.checkout_button.y')>
<cflocation url="checkout.cfm">
</cfif>
<cflocation url="cartlist.cfm">
カートリスト.cfm
<cfset nTotal = 0 />
<cfform action="cart_manage.cfm" method="post">
<table width="100%">
<tr valign="top">
<td>
<table width="100%" class="white">
<tr>
<td class="tblehead"> </td>
<td class="tblehead">Item</td>
<td class="tblehead">Price Per Item</td>
<td class="tblehead">Quantity</td>
<td class="tblehead">Price</td>
</tr>
<cfoutput>
<cfloop from="1" to="#ArrayLen(SESSION.cart)#" index="i">
<tr>
<td height="40" width="40" align="center" class="dkturq">
<cfinput type="checkbox" name="delete_index" value="#i#" />
</td>
<td height="40" class="dkturq">
#SESSION.cart[i].item#
</td>
<td height="40" class="dkturq">
£#(SESSION.cart[i].price)#
</td>
<td height="40" class="dkturq">
<cfinput type="text" name="quantity_#i#" value="#SESSION.cart[i].quantity#" size="5" class="field" />
</td>
<td height="40" class="dkturq">
<cfset nPrice = SESSION.cart[i].quantity * SESSION.cart[i].price />
<cfset nTotal = nTotal + nPrice />
£#(nPrice)#
</td>
</tr>
</cfloop>
</cfoutput>
</table>
</td>
<td></td>
<td>
<table width="100%" height="100%" class="white">
<tr>
<td class="tblehead">
Summary
</td>
</tr>
<tr>
<td class="dkturq">
total:
<cfoutput>£#(nTotal)#</cfoutput>
<br /><br /><br /><br />
<a href="clear.cfm">Clear Shopping Cart</a>
<cfinput type="submit" name="update_button" id="update_button" value="update" />
<cfinput type="submit" name="delete_button" id="delete_button" value="delete" /><br /></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</cfform>
FORMのCFDUMP
Session.cart の CFDUMP
エラー:
削除を押したときのCFDUMP