My situation:
I have a dynamic form with checkboxes. The checkboxes are submitted and added to a database. They are a list.
I want to compare the list with what is currently listed in the database. If there is anything new or removed, I want to know with a variable that says changed.
Basically:
Checkboxes = 1,2,3
Database rows and fields are:
row | field
1 | 2
2| 3
I want to know that 1 is new. OR if 2 is removed, I want to know that.
I've tried using listfind and listcontains, but I still cannot get this to work right.
I've even tried an array:
I have a dynamic form with checkboxes. The checkboxes are submitted and added to a database. They are a list.
I want to compare the list with what is currently listed in the database. If there is anything new or removed, I want to know with a variable that says changed.
Basically:
Checkboxes = 1,2,3
Database rows and fields are:
row | field
1 | 2
2| 3
I want to know that 1 is new. OR if 2 is removed, I want to know that.
I've tried using listfind and listcontains, but I still cannot get this to work right.
I've even tried an array:
Code:
<cfoutput>#old.ID#</cfoutput> <cfset chkChanged=ArrayNew(1)> <cfoutput query="old"> <cfloop list="#form.chk#" index="chk"> <cfif #ID# IS NOT #chk# > <cfset chkChanged[CurrentRow]= id> </cfif> </cfloop> </cfoutput>
Comment