Hi , Please use ListFind(newlist,"4").

There is a difference between listcontains and ListFind, somehow, the
following code will print "index:2","index2:5":

<cfset newlist="1,44,5,40,4,50">
<cfset index=listContains(newlist,"4")>
<cfset index2=listFind(newlist,"4")>
<cfoutput>index: #index#<br>
index2: #index2#</cfoutput>

According to the documenttation:
ListFind:Returns the index of the first occurrence of a value within a
list. Returns 0 if no value is found. The search is case-sensitive.

Listcontains():Returns the index of the first item that contains the
specified substring. The search is case-sensitive. If the substring is
not found in any of the list items, it returns zero (0). 

HTH

Sima
 



-----Original Message-----
From: van Wyk, Carlo [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 19, 2001 5:28 AM
To: CF-Talk
Subject: Listcontains question


Hi

I have the following piece of code that checks to see if a user can see
a
specific pageid or not. Unfortunately it is not doing the job as I have
a
list that looks something like this:

4,14,3,2,8,44

If the user is allowed to see page 4, then he would be able to see all
pages
that contains a 4, so it does not work correctly.


<cfif listcontains(newlist,  "#pageid#")>
                <cfinclude template=#page#>
        <cfelse>
        <cfoutput>
        #application.securityerror#
        </cfoutput>
</cfif>

Regards
Carlo
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to