Solved

naming and accessing form elements through loop

Posted on 2004-08-11
32
432 Views
Last Modified: 2013-12-24
I havea form, and it is made through a loop, like this:

                    <form method="post">
                      <cfloop collection="#session.cart#" item="i">
                              <input type="checkbox" name="deleteitem<cfoutput>#i#</cfoutput>" alt="Delete Item">
                              <input type="hidden" name="itemproductid<cfoutput>#i#</cfoutput>" value="#session.cart[i][1]#">
                              <input type="hidden" name="itemperiodid<cfoutput>#i#</cfoutput>" value="#session.cart[i][2]#">
                              <input type="text" name="itemquantity<cfoutput>#i#</cfoutput>" size="2" value="#session.cart[i][3]#">
                      </cfloop>
                            <input type="hidden" name="cartaction" value="">
                             <input type="button" value="Delete Checked Items" class="submit" onClick="document.getElementById('cartaction').value='delete';submit();"></td>
                           <input name="submit2" type="submit" value="Update Cart" class="submit" onClick="document.getElementById('cartaction').value='update';submit();">
                    </form>

Now when the user submits the form using either "update" or "delete", I want specific things to happen, so I wrote this:

<cfif isdefined("form.cartaction")>
    <cfif form.cartaction eq "delete">
       <cfloop collection="#session.cart#" item="i">
         <cfif form.deleteitem#i#.checked> <!--- based on the way I named the items, this doesn't work in the IF statement for some reason, even if i throw cfoutput tags around the #i#--->
              <cf_dropItem productid="#form.itemproductid#"> <!-- delete the item--->
          </cfif>
        </cfloop>
    <cfelseif form.cartaction eq "update">
         <cfloop collection="#session.cart#" item="i">
              <cf_addItem productid = "#form.itemproductid#"  quantity = "#form.itemquantity#i##"> <!-- update the item quantity, same problem as before, I know you can't do this, but its here to show you what I'm trying to do--->
         </cfloop>
    </cfif>
</cfif>

Please correct this to let me know how I can make it work!  Its kind of urgent, so thanks for your time
0
Comment
Question by:Eduski
  • 16
  • 14
  • +1
32 Comments
 
LVL 25

Expert Comment

by:James Rodgers
ID: 11774692
you cant address from elemnts like this in cf

<cfif form.deleteitem#i#.checked>
if it is a checkbox then use
<cfif isDefined('form.deleteitem#i#')>
checkboxes are onlysubmitted if they are checked

if its a radio
 <cfif isDefined('form.deleteitem#i#') and'form.deleteitem#i# EQ true>
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 11774861
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 11774960
hee is some improved syntax

<cfif isDefined("Form["deleteitem#variables.i#"]")>
0
 
LVL 3

Author Comment

by:Eduski
ID: 11775387
ok thanks for that part, now for the other part... how do i correct this statement?

<cf_dropItem productid="#form.itemproductid#i##">
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 11775505
<cf_dropItem productid="#Form["deleteitem#variables.i#"]#">

should work
0
 
LVL 3

Author Comment

by:Eduski
ID: 11775635
<cfif isdefined("form.cartaction")>
    <cfif form.cartaction eq "delete">
       <cfloop collection="#session.cart#" item="i">
         <cfif isDefined("Form["deleteitem#variables.i#"]")>
                <cf_dropItem productid="#Form["itemproductid#variables.i#"]#">
          </cfif>
        </cfloop>
    <cfelseif form.cartaction eq "update">
         <cfloop collection="#session.cart#" item="i">
              <cf_addItem productid="#Form["itemproductid#variables.i#"]#" quantity = "#Form["itemquantity#variables.i#"]#">
         </cfloop>
    </cfif>
</cfif>

this doesn't work, says that the isdefined function for the 4th line is troublesome, thanks for your help
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 11775641
or this

FORM["deleteitem" & variables.i]#
0
 
LVL 3

Author Comment

by:Eduski
ID: 11775712
do i need the #'s or not.. you didnt start with one but u ended with one, i think they should be there, correct me if i'm wrong
0
 
LVL 3

Author Comment

by:Eduski
ID: 11775733
Element deleteitem22 is undefined in a Java object of type class coldfusion.filter.FormScope referenced as  
 
4 :     <cfif form.cartaction eq "delete">
5 :        <cfloop collection="#session.cart#" item="i">
6 :          <cfif isDefined("#FORM["deleteitem" & variables.i]#")>
7 :                 <cf_dropItem productid="#FORM["itemproductid" & variables.i]#">
8 :           </cfif>

 
now i get this, with line 6 in bold... deleteitem22 is correct
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 11775780
the line looks ok

try it without the#


<cfif isDefined("FORM["deleteitem" & variables.i]")>
or like

<cfif isDefined("FORM["deleteitem" & #variables.i#]")>


0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 11775796
if that doesn't solve it then it may be the nested ""


<cfif isDefined("FORM['deleteitem' & #variables.i#]")>
0
 
LVL 3

Author Comment

by:Eduski
ID: 11776129
Parameter 1 of function IsDefined, which is now &quot;FORM[&apos;deleteitem&apos; & 201]&quot;, must be a syntactically valid variable name.

Tried the third way, then get this
0
 
LVL 3

Author Comment

by:Eduski
ID: 11776149
Element deleteitem201 is undefined in a Java object of type class coldfusion.filter.FormScope referenced as  
 
4 :     <cfif form.cartaction eq "delete">
5 :        <cfloop collection="#session.cart#" item="i">
6 :         <cfif isDefined(FORM['deleteitem' & #variables.i#])>
7 :                 <cf_dropItem productid="FORM['itemproductid' & #variables.i#]">
8 :           </cfif>

 
Removing the outer quotes gets this, again line 6 in bold
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 11776179
are you only submitting one test to see if this routine is functioning or multiple submissions?

if multiple does it fail on the first attempt or later in teh processing?
0
 
LVL 3

Author Comment

by:Eduski
ID: 11776220
just one test, I have items in the struct, and I click the checkbox next to one, hit the "Delete Checked Items" button, and it takes me to this:

Parameter 1 of function IsDefined, which is now &quot;FORM[&apos;deleteitem&apos; & 201]&quot;, must be a syntactically valid variable name.  line 6
 
4 :     <cfif form.cartaction eq "delete">
5 :        <cfloop collection="#session.cart#" item="i">
6 :         <cfif isDefined("FORM['deleteitem' & #variables.i#]")>
7 :                 <cf_dropItem productid="FORM['itemproductid' & #variables.i#]">
8 :           </cfif>

 
0
 
LVL 3

Author Comment

by:Eduski
ID: 11776225
not sure why it wants to convert the quotes

isn't there a preservequote function or something like that... forgive me, its a pain i know, and i appreciate all of your time put into this
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 25

Expert Comment

by:James Rodgers
ID: 11776399
np

try reversing the quotes

<cfif isDefined('FORM["deleteitem" & #variables.i#]')>
0
 
LVL 3

Author Comment

by:Eduski
ID: 11776838
nothin doin, any other ideas?
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 11776886
strange i've checked the syntax several times and it looks ok

let me check some other code and i'll get back to you
0
 
LVL 3

Author Comment

by:Eduski
ID: 11776901
would you like me to post my whole code, and give you more than that?
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 11776910
ok what about a listfind?

<cfif form.cartaction eq "delete">
        <cfloop collection="#session.cart#" item="i">
         <cfif listFindNoCase(form.FieldNames, 'deleteitem' & #variables.i#)>
                 <cf_dropItem productid="FORM['itemproductid' & #variables.i#]">
          </cfif>
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 11776920
yea please post entire code for form and action page, thanks

0
 
LVL 3

Author Comment

by:Eduski
ID: 11777859
the form and action page are the same:

<cfdump var="#session.cart#">

<cfif isdefined("form.cartaction")>
    <cfif form.cartaction eq "delete">
       <cfloop collection="#session.cart#" item="i">
        <cfif isDefined("FORM["deleteitem" & #variables.i#]")>
                <cf_dropItem productid="FORM['itemproductid' & #variables.i#]">
          </cfif>
        </cfloop>
    <cfelseif form.cartaction eq "update">
         <cfloop collection="#session.cart#" item="i">
              <cf_addItem productid="FORM['itemproductid' & #variables.i#]" quantity="FORM['itemquantity' & #variables.i#]">
         </cfloop>
    </cfif>
</cfif>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ABC: Hardware, Rental, Special Events</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="abcstyle.css"><META name="description" content="ABC Hardware, Rental, and Special Events in Buffalo, New York has all of your party rental and equipment rental needs right here! From Tents, tables, and chairs to power tools to construction equipment, we have it all!">
<META name="keywords" content="tent, table, chair, rental, party rental, inflatables, bounce houses, generators, buffalo, new york, power tools, construction tools, construction, rent, wedding"></head>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

<body class="margin" onLoad="MM_preloadImages('Images/nav_administrative_on.gif','Images/nav_employment_on.gif','Images/nav_eqrental_on.gif','Images/nav_eqsales_on.gif','Images/nav_generators_on.gif','Images/nav_hardware_on.gif','Images/nav_industrial_on.gif','Images/nav_partyrental_on.gif')">
<center>
  <table width="765" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td height="80" colspan="4"><font size="2" face="verdana"><img src="Images/header_01.gif"></font></td>
    </tr>
    <tr>
      <td width="151" valign="top" bgcolor="#000066"><cfinclude template="nav.cfm"></td>
      <td width="611" colspan="2" valign="top" background="Images/cellbg.gif" bgcolor="#000066"><div align="center">
          <table width="611" border="0" cellspacing="0" cellpadding="0" align="center">
            <tr>
              <td width="302" height="19"><font face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
              <td width="307"><font face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
            </tr>
            <tr>
              <td height="16" colspan="2" bgcolor="#000066">
                <div align="center" class="headertd">SHOPPING CART
                  </div>
                </td>
            </tr>
            <tr>
              <td colspan="2"><table border=0 width="615" cellspacing="0">
                <tr>
                  <td width="83" class="normaltd"><strong>QUANTITY</strong></td>
                  <br>
                  <td width="216" class="normaltd"><strong>PRODUCT</strong></td>
                  <td width="97" align="right" class="normaltd"><strong>RENTAL
                    PERIOD</strong></td>
                  <td width="83" align="right" class="normaltd"><strong>UNIT PRICE</strong></td>
                  <td width="113" align="right" class="normaltd"><strong>TOTAL
                    PRICE</strong></td>
                </tr>
                <!--- Make sure that the shopping cart structure exists and is the correct format --->
                <cfif isdefined("session.cart")>
                  <cfif IsStruct(session.cart)>
                    <!--- Initialize variables --->
                    <cfset subtotal = 0>
                    <form method="post">
                      <cfloop collection="#session.cart#" item="i">
                        <cfquery datasource="products" name="loopproduct">
                        select * from allproducts where productid = #session.cart[i][1]#
                        and periodid = #session.cart[i][2]#
                        </cfquery>
                        <cfoutput query="loopproduct">
                          <cfset totalunitprice = session.cart[i][3] * price>
                          <cfset subtotal = subtotal + totalunitprice>
                          <tr>
                            <td class="normaltd">
                              <input type="checkbox" name="deleteitem<cfoutput>#i#</cfoutput>" alt="Delete Item">
                              <input type="hidden" name="itemproductid<cfoutput>#i#</cfoutput>" value="#session.cart[i][1]#">
                              <input type="hidden" name="itemperiodid<cfoutput>#i#</cfoutput>" value="#session.cart[i][2]#">
                              <input type="text" name="itemquantity<cfoutput>#i#</cfoutput>" size="2" value="#session.cart[i][3]#">
                             
                            </td>
                            <td valign="top">
                              <a href="getproduct.cfm?productid=#session.cart[i][1]#" class="description">#description#</a></td>
                            <!---- This is the modified code created during the checkout counter portion --->
                            <td valign=top align=right class="normaltd">#rentalperiod#</td>
                            <td valign=top align=right class="normaltd">#dollarformat(price)#</td>
                            <td valign=top align=right class="normaltd">#dollarformat(totalunitprice)#</td>
                          </tr>
                        </cfoutput>
                      </cfloop>                          <tr>
                            <td colspan="3"><input type="hidden" name="cartaction" value=""><input type="button" value="Delete Checked Items" class="submit" onClick="document.getElementById('cartaction').value='delete';submit();"></td>
                            <td colspan="3"><input name="submit2" type="submit" value="Update Cart" class="submit" onClick="document.getElementById('cartaction').value='update';submit();"></td>
                          </tr>
                    </form>
                    <cfscript>
                              salesTax = subtotal * .0825;
                              total = subtotal + salesTax;
                        </cfscript>
                    <!--- This is where we print out the summary info that we just calculated --->
                    <cfoutput>
                      <tr>
                        <!--- This piece was added during the checkout counter phase --->
                        <td height="21" colspan="6" valign="middle" aligh=center><div align="right">SUBTOTAL
                            #dollarformat(subtotal)#
                            <!--- This piece was added during the checkout counter phase --->
                          </div></td>
                        <td width="1" height="21">&nbsp;</tr>
                      <tr>
                        <td height="22" colspan="6" valign="middle" aligh=center><div align="right">TAX#dollarformat(salesTax)#</div></td>
                      </tr>
                      <tr>
                        <td colspan="6" valign="middle" aligh=center><div align="right">TOTAL#dollarformat(total)#</div></td>
                      </tr>
                      <tr>
                        <td colspan="6"> <form action="confirmorder.cfm">
                            <input type="hidden" value="#total#" name="total">
                            <input name="submit22" type="submit" value="Proceed To Check Out >>" class="submit"></font>
                          </form></td>
                      </tr>
                    </cfoutput>
                  </cfif>
                </cfif>
              </table>
                </td>
            </tr>
          </table>
       </td>
    </tr>
  </table><cfinclude template="footer.cfm">
  </center>
</body>
</html>

it's a mess, I know, and I still have to clean it up, but I appreciate your help
0
 

Assisted Solution

by:speshal
speshal earned 100 total points
ID: 11778927
<input type="checkbox" name="deleteitem<cfoutput>#i#</cfoutput>" alt="Delete Item">
should be
<input type="checkbox" name="deleteitem" value="deleteitem<cfoutput>#i#</cfoutput>" alt="Delete Item">

and

<cfif form.deleteitem#i#.checked>
  <cf_dropItem productid="#form.itemproductid#"> <!-- delete the item--->
</cfif>
should be
<cfif ListContains(deleteitem,"#i#")
  <cf_dropItem productid="#form["itemproductid" & i]#"> <!-- delete the item--->
</cfif>

checkboxes named similar are part of an array, just assign a value to it, much like a radio buttion and pull it out of the list as shown above.
0
 
LVL 12

Expert Comment

by:jyokum
ID: 11779803
give this a try

<cfif StructKeyExists(form,'deleteitem#variables.i#')>
      <cfset key="itemproductid" & variables.i>
      <cf_dropItem productid="#form[key]#">
</cfif>
0
 
LVL 25

Accepted Solution

by:
James Rodgers earned 400 total points
ID: 11782819
i made some changes to the code... try this let me know
you had some nested cfoutput blocks also, i removed them


<cfdump var="#session.cart#">

<cfif isdefined("form.cartaction")>
    <cfif form.cartaction eq "delete">
       <cfloop collection="#session.cart#" item="i">
        <cfif isDefined("FORM['deleteitem' & #variables.i#]")>
                <cf_dropItem productid="FORM['itemproductid' & #variables.i#]">
          </cfif>
        </cfloop>
    <cfelseif form.cartaction eq "update">
         <cfloop collection="#session.cart#" item="i">
              <cf_addItem productid="FORM['itemproductid' & #variables.i#]" quantity="FORM['itemquantity' & #variables.i#]">
         </cfloop>
    </cfif>
</cfif>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ABC: Hardware, Rental, Special Events</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="abcstyle.css"><META name="description" content="ABC Hardware, Rental, and Special Events in Buffalo, New York has all of your party rental and equipment rental needs right here! From Tents, tables, and chairs to power tools to construction equipment, we have it all!">
<META name="keywords" content="tent, table, chair, rental, party rental, inflatables, bounce houses, generators, buffalo, new york, power tools, construction tools, construction, rent, wedding"></head>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

<body class="margin" onLoad="MM_preloadImages('Images/nav_administrative_on.gif','Images/nav_employment_on.gif','Images/nav_eqrental_on.gif','Images/nav_eqsales_on.gif','Images/nav_generators_on.gif','Images/nav_hardware_on.gif','Images/nav_industrial_on.gif','Images/nav_partyrental_on.gif')">
<center>
  <table width="765" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td height="80" colspan="4"><font size="2" face="verdana"><img src="Images/header_01.gif"></font></td>
    </tr>
    <tr>
      <td width="151" valign="top" bgcolor="#000066"><cfinclude template="nav.cfm"></td>
      <td width="611" colspan="2" valign="top" background="Images/cellbg.gif" bgcolor="#000066"><div align="center">
          <table width="611" border="0" cellspacing="0" cellpadding="0" align="center">
            <tr>
              <td width="302" height="19"><font face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
              <td width="307"><font face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
            </tr>
            <tr>
              <td height="16" colspan="2" bgcolor="#000066">
                <div align="center" class="headertd">SHOPPING CART
                  </div>
                </td>
            </tr>
            <tr>
              <td colspan="2"><table border=0 width="615" cellspacing="0">
                <tr>
                  <td width="83" class="normaltd"><strong>QUANTITY</strong></td>
                  <br>
                  <td width="216" class="normaltd"><strong>PRODUCT</strong></td>
                  <td width="97" align="right" class="normaltd"><strong>RENTAL
                    PERIOD</strong></td>
                  <td width="83" align="right" class="normaltd"><strong>UNIT PRICE</strong></td>
                  <td width="113" align="right" class="normaltd"><strong>TOTAL
                    PRICE</strong></td>
                </tr>
                        <cfoutput>
                <!--- Make sure that the shopping cart structure exists and is the correct format --->
                <cfif isdefined("session.cart")>
                  <cfif IsStruct(session.cart)>
                    <!--- Initialize variables --->
                    <cfset subtotal = 0>
                    <form method="post">
                      <cfloop collection="#session.cart#" item="i">
                      <cfquery datasource="products" name="loopproduct">
                        select * from allproducts where productid = #session.cart[i][1]#
                        and periodid = #session.cart[i][2]#
                        </cfquery>
                        <cfoutput query="loopproduct"> --->
                          <cfset totalunitprice = session.cart[i][3] * price>
                          <cfset subtotal = subtotal + totalunitprice>
                          <tr>
                            <td class="normaltd">
                              <input type="checkbox" name="deleteitem#i#" alt="Delete Item">
                              <input type="hidden" name="itemproductid#i#" value="#session.cart[i][1]#">
                              <input type="hidden" name="itemperiodid#i#" value="#session.cart[i][2]#">
                              <input type="text" name="itemquantity#i#" size="2" value="#session.cart[i][3]#">
                             
                            </td>
                            <td valign="top">
                              <a href="getproduct.cfm?productid=#session.cart[i][1]#" class="description">#description#</a></td>
                            <!---- This is the modified code created during the checkout counter portion --->
                            <td valign=top align=right class="normaltd">#rentalperiod#</td>
                            <td valign=top align=right class="normaltd">#dollarformat(price)#</td>
                            <td valign=top align=right class="normaltd">#dollarformat(totalunitprice)#</td>
                          </tr>
                        </cfoutput>
                     </cfloop>                <tr>
                            <td colspan="3"><input type="hidden" name="cartaction" value=""><input type="button" value="Delete Checked Items" class="submit" onClick="document.getElementById('cartaction').value='delete';submit();"></td>
                            <td colspan="3"><input name="submit2" type="submit" value="Update Cart" class="submit" onClick="document.getElementById('cartaction').value='update';submit();"></td>
                          </tr>
                    </form>
                    <cfscript>
                         salesTax = subtotal * 0.0825;
                         total = subtotal + salesTax;
                    </cfscript>
                    <!--- This is where we print out the summary info that we just calculated --->
                    <cfoutput>
                      <tr>
                        <!--- This piece was added during the checkout counter phase --->
                        <td height="21" colspan="6" valign="middle" aligh=center><div align="right">SUBTOTAL
                            #dollarformat(subtotal)#
                            <!--- This piece was added during the checkout counter phase --->
                          </div></td>
                        <td width="1" height="21">&nbsp;</tr>
                      <tr>
                        <td height="22" colspan="6" valign="middle" aligh=center><div align="right">TAX#dollarformat(salesTax)#</div></td>
                      </tr>
                      <tr>
                        <td colspan="6" valign="middle" aligh=center><div align="right">TOTAL#dollarformat(total)#</div></td>
                      </tr>
                      <tr>
                        <td colspan="6"> <form action="confirmorder.cfm">
                            <input type="hidden" value="#total#" name="total">
                            <input name="submit22" type="submit" value="Proceed To Check Out >>" class="submit"></font>
                          </form></td>
                      </tr>
                    </cfoutput>
                 </cfif>
                </cfif>
              </table>
                </td>
            </tr>
          </table>
       </td>
    </tr>
  </table><cfinclude template="footer.cfm">
  </center>
</body>
</html>
0
 
LVL 3

Author Comment

by:Eduski
ID: 11783227
Jester,
I'm getting a problem with your code,

Invalid tag nesting configuration.  
A query driven CFOUTPUT tag is nested inside a CFOUTPUT tag that also has a QUERY= attribute. This is not allowed. Nesting these tags implies that you want to use grouped processing. However, only the top-level tag can specify the query that drives the processing.

line 95

93 :                         and periodid = #session.cart[i][2]#
94 :                         </cfquery>
95 :                         <cfoutput query="loopproduct">
96 :                           <cfset totalunitprice = session.cart[i][3] * price>
97 :                           <cfset subtotal = subtotal + totalunitprice>

I can't figure out why, unless you can't put the cfoutput query= tags inside a cfloop, but i thought i did that before, any ideas?
0
 
LVL 3

Author Comment

by:Eduski
ID: 11783251
nevermind, i fixed it
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 11783276
remove teh <cfouput> from line 83 and the </cfoutput> from line 124
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 11783283
ok ...you got it
0
 
LVL 3

Author Comment

by:Eduski
ID: 11783418
beautiful, thanks so much everyone
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 11783451
glad I could help

thanks for the points
0

Featured Post

Superior storage. Superior surveillance.

WD Purple drives are built for 24/7, always-on, high-definition security systems. With support for up to 8 hard drives and 32 cameras, WD Purple drives are optimized for surveillance.

Join & Write a Comment

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now