Michael,
There might be a better way to do this. The code you have right now is
creating a uniquely named checkbox for each record found by the search.
You might find your solution easier if you switched this and just did
something like this on your search results page:
<!--- find records based on search criteria --->
<cfquery name="qSearch" datasource="yourDSN">
select id, strName
from yourTable
where ... etc ...
</cfquery>
<!--- display matching records --->
<cfoutput query="qSearch">
#strName# <input type="checkbox" name="chkPrint"
value="#id#"><br>
</cfoutput>
So what you'd be doing here is creating a checkbox with the SAME name
for every matching record, but assign the value of each checkbox based
on the unique ID of a record.
The reason you want to do this is because then when you submit your
form, on the processing page you'll simply have one variable called
"chkPrint" that will have a comma-delimited list of the IDs that you
checked on the results page. Then you could just do something like
this:
<cfloop list="#form.chkPrint#" index="id">
<cfset strSQL = "#strSQL#&ID=#id# or ">
</cfloop>
Hope this makes sense.
Regards,
Tyson
-----Original Message-----
From: Michael Wolter [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 08, 2001 3:04 PM
To: CF-Talk
Subject: getting values out of numbered form fields
I have a set of forms that allow the user to search a database, display
matching records and then lets the user select specific records to
print.
The search displays matches in a form with check boxes for each record.
So I need to loop through these numbered form fields, but I don't know
how
many there might be.
The code I have is:
<cfloop condition="isdefined(chkPrint#pos#)">
<cfset strSQL = strSQL & "ID = " & PrintID#pos# & " or ">
<cfset pos = pos + 1>
</cfloop>
The part where I am checking for the existence of the field seems to
work,
but I can't figure out how to pull in the values from these fields and
add
them to my string.
Thanks in advance for any insights.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-| Michael Wolter
[EMAIL PROTECTED] |
| Administrative Programmer/Analyst Carlisle, PA 17013 |
| Dickinson College, Computer Services (717) 245-1527 |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists