Thanks Gene but how do I apply that to my loop so the number one is equal to
X?

For example I've tried this but it doesn't seem to like it: 

<CFIF form["tick#currentID#"] eq 1>

Where currentID = #listGetAt(form.id_array, i)# 
(i.e. the number current selected from the list).

If the tick box is equal to 1 (ticked) then it runs my query, otherwise it
ignores it and moves onto the next tick box.

Hope that makes sense and thanks again.

Cheers,
James

-----Original Message-----
From: Gene Brown [mailto:[EMAIL PROTECTED] 
Sent: 17 June 2004 15:29
To: [EMAIL PROTECTED]
Subject: RE: [ cf-dev ] Looping through a list

James,
 
I think this should do it...
 
<cfif form["#tick1#"] eq 1>
 
 
Cheers
Gene


________________________________

From: James Buckingham [mailto:[EMAIL PROTECTED] 
Sent: 17 June 2004 15:07
To: '[EMAIL PROTECTED]'
Subject: [ cf-dev ] Looping through a list



Hi guys,

 

I've got a form with X number of tick boxes on it (the number being
controlled by the number of records pulled from the DB). 

 

Each tick box is given the name 'Tick' followed by the ID from the database
record. So say I had 5 records, the tick box names would be
Tick1,Tick2,Tick3,Tick4,Tick5.

 

The user ticks the boxes they want to delete from the database and then
submits the form.

 

The form sends through the tick box values and also a hidden variable with a
list of all the ID's that where on the form. The idea being that I use the
list to a) tell how many tick boxes there were and b) what the ID's of the
records/tick boxes are.

 

This might be a long way of doing this (so correct me if there is an easier
way) but what I want to do is loop through each tick box and find out if it
has been ticked. If it has I want to run a query to delete that record.

 

Here's my code so far:

 

<CFSET last= listLen(#form.id_list#, ",")>

 

<CFLOOP FROM="1" TO="#last#" INDEX="i">

            <CFIF form.tick#id# eq 1>

<CFQUERY  . ...... >

 DELETE RECORD

</CFQUERY>

 

                        <!--- display test data //-->

                        <CFOUTPUT> #listGetAt(form.id_list, i)# </CFOUTPUT>

            </CFIF>

</CFLOOP>

 

My problem is how do I say in Cold Fusion .... 

<CFIF #form.tick1# eq 1>, 

<CFIF #form.tick2# eq 1>,

<CFIF #form.tick3# eq 1>,

 

....where I have the static wording 'form.tick' and attach the ID from the
list to the end of the wording. I've tried a few combinations but it's not
budging for me L

 

Cheers,

JamesB

 



-- 
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
by activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]

-- 
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]

Reply via email to