|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
New at Structures
Author: Dave Watts
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32543#163339
> I'm new at Structures...I wanted to add variables to the
> "items" structure. The variables increment as they go thru
> a loop. The variable is called "qty" and as it goes thru
> the loop it would increment as "qty1", "qty2", etc thru a
> form. Here's the code. I'm having an obvious problem with the
> <CFSET items.qty#countlist#=qty(#countlist#)> which I know is
> not the right syntax...
You can use array syntax to reference your structure keys:
<cfset items["qty#countlist#"] = ...>
But I'm not sure exactly what you're trying to do with the rest of your
code. Currently, you have two places where you're creating hidden form
fields named "qty" within the same page, which probably won't give you the
result you want.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
phone: 202-797-5496
fax: 202-797-5444
Author: Robert Orlini
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32543#163338
I'm new at Structures...I wanted to add variables to the "items" structure.
The variables increment as they go thru a loop. The variable is called "qty" and
as it goes thru the loop it would increment as "qty1", "qty2", etc thru a form.
Here's the code. I'm having an obvious problem with the <CFSET
items.qty#countlist#=qty(#countlist#)> which I know is not the right syntax...
Any thoughts please? Thanks as always.
Robert at HWW
<CFIF isDefined("form.more.x")>
<cfset countList = countList + 1>
</cfif>
<cfloop index="record" from="1" to="#countList#" step="1">
<form action="purchaseorder_Page_3.cfm" method="POST">
<input type="hidden" name="qty" value>
<CFOUTPUT>
<tr>
<td width="25%" bgcolor="##FFEEB3" align="center">
<input type="text" name="qty" size="4"></td>
</tr>
</CFOUTPUT>
<CFSET items=StructNew()>
<CFIF IsDefined("qty#countlist#")>
<CFSET items.qty#countlist#=qty(#countlist#)>
</cfif>
<cfoutput>
#items.qty#countlist#<br>
</cfoutput>
</CFLOOP>
|
May 24, 2012
|
Latest Fusion Authority Articles
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||