2 Possible Solutions off the top of my head:

1. Use List Qualify and then add qualifiers around the data being passed.
2. Use the UDF Below if you're running CF5. This is essentially the same as
above, just in UDF form so that it's easy to remember.

usage: <cfoutput>#ListContainsUnique(yourlist,'4')#</cfoutput>

function ListContainsUnique(list,compare){
        var delim = "";
        var argc = ArrayLen(arguments);
        if (argc EQ 2) {
                ArrayAppend(arguments,',');
        }
        delim = arguments[3];
        compare="+#compare#+";
        list=ListQualify(list,"+",delim,"ALL");
        if(ListContains(list,compare,delim)){
                return true;
        }else{
                return false;
        }
}

Joshua Miller
Web Development::Programming
Eagle Technologies Group, Inc.
www.eagletgi.com
[EMAIL PROTECTED]

-----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/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
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