Reputation: 1521
I thought I had this one licked... But I can't seem to get it tracked down...
Funny thing is - the list delete function works... And performs the desired task... But I still get this error...
Invalid list index 0. In function ListDeleteAt(list, index [, delimiters]), the value of index, 0, is not a valid as the first argument (this list has 12 elements). Valid indexes are in the range 1 through the number of elements in the list.
The error occurred on line 735.
Code below
<cfset pwlist = "#add.pwlist#">
<cfset curlist = "#add.pwlist#">
<cfset ud = "#session.demshinuser_id#">
<cfoutput>
#curlist#
<br>
<br>
#pwlist#
<br><br>
#ud#<br>
<cfset newlist = ListDeleteAt(curlist, ListFind(pwlist,ud,","), ",")> <-- Error Here
#newlist#
</cfoutput>
<cfquery name=Update DATASOURCE="#ds#">
update shindates
set
pwlist = '#newlist#'
where shinid = '#shinid#'
</cfquery>
<cfif src is "cpwupc">
<cflocation url="upc.cfm" addToken="no">
</cfif>
<cfif src is "hcpw">
<cflocation url="list.cfm?typeid=#add.typeid#" addToken="no">
</cfif>
Found on Goog - trying this too to check if it a bad list thing... and ud isn't in list in first place...
<cfset pos = listfind(pwlist,ud)>
<cfif pos>
do list delete
<cfelse>
error. element not found. do something else
</cfif>
Upvotes: 0
Views: 1254
Reputation: 93
I had a similar issue. The problem is up near the top of your code where you are setting the supposed lists. They aren't lists. Which is why your various List functions aren't working. Add the ValueList function around each of them and then they will become lists.
Example:
<cfset pwlist = "#ValueList(add.pwlist)#">
Upvotes: 0