|
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 |
- RE: [ cf-dev ] Looping through a list James Buckingham
- RE: [ cf-dev ] Looping through a list Gene Brown
- RE: [ cf-dev ] Looping through a list James Buckingham
- RE: [ cf-dev ] Looping through a list Tim Blair
- RE: [ cf-dev ] Looping through a list Adrian Lynch
