http://acoderslife.com
-Original Message-
From: Ian Skinner [mailto:[EMAIL PROTECTED]
Sent: Friday, January 18, 2008 12:16 PM
To: CF-Talk
Subject: SOT: JavaScript version of listContains()
Does anybody know if there is a simple, basic JavaScript equivalent of
the CFML listContains
On Jan 18, 2008 9:35 AM, Claude Schneegans [EMAIL PROTECTED] wrote:
that's not to say there's not a simple way tho.
The only other way I can think of is using regExp, but not really simpler.
yeah, i thought about using subStr... but then you'd have to check for
an optional comma in front and
Does anybody know if there is a simple, basic JavaScript equivalent of
the CFML listContains() function that can determine if a given value is
one of four possible values.
TIA
Ian
~|
Adobe® ColdFusion® 8 software 8
Claude Schneegans wrote:
that's not to say there's not a simple way tho.
The only other way I can think of is using regExp, but not really simpler.
Actually after thinking on this a bit it turned out to be fairly
simple. At least for my immediate need of 6 possible 1 character values.
I do not know if it is the same person, but there is a CF JS function plugin
for jQuery.
http://cfjs.riaforge.org/
I did not look to see if it has listcontains or not, just assumed it does.
On Jan 18, 2008 11:38 AM, Jerry Guido [EMAIL PROTECTED] wrote:
Not exactly. But close.
ListFind
sorry, I responded too quick. This will actually be ListFind and not
ListContains.
On Jan 18, 2008 2:32 PM, Qasim Rasheed [EMAIL PROTECTED] wrote:
I am hoping this will work
function ListContains(list,item,delim){
var del = (delim == null)? ,: delim;
return list.split(del).indexOf
I am hoping this will work
function ListContains(list,item,delim){
var del = (delim == null)? ,: delim;
return list.split(del).indexOf(item) != -1;
}
On Jan 18, 2008 12:38 PM, Charlie Griefer [EMAIL PROTECTED] wrote:
On Jan 18, 2008 9:35 AM, Claude Schneegans [EMAIL PROTECTED]
wrote
PROTECTED]
Sent: Friday, January 18, 2008 12:16 PM
To: CF-Talk
Subject: SOT: JavaScript version of listContains()
Does anybody know if there is a simple, basic JavaScript equivalent of
the CFML listContains() function that can determine if a given value is
one of four possible values.
TIA
Ian
received this transmittal in error; any review,
dissemination, distribution or copying of this transmittal is strictly
prohibited.
-Original Message-
From: Aaron Rouse [mailto:[EMAIL PROTECTED]
Sent: Friday, January 18, 2008 2:42 PM
To: CF-Talk
Subject: Re: JavaScript version of listContains
The guy from leftcorner.com (offline) ported a bunch of CF functions to
JS. I still have a copy. Pretty handy.
Pretty handy indead.
Javascript looks like a retarded language when dealing with strings.
Thanks.
--
___
REUSE CODE! Use custom tags;
See
that's not to say there's not a simple way tho.
The only other way I can think of is using regExp, but not really simpler.
--
___
REUSE CODE! Use custom tags;
See http://www.contentbox.com/claude/customtags/tagstore.cfm
(Please send any spam to this address:
and suggested my long-ass way that jim
davis comes along and says, sure... just use __ (and he's right,
dammit) :)
On Jan 18, 2008 9:16 AM, Ian Skinner [EMAIL PROTECTED] wrote:
Does anybody know if there is a simple, basic JavaScript equivalent of
the CFML listContains() function that can
i have a list like this...
15,0,2,5
when i run a listcontains on it for the number 1 - i get back a positive
response. i guess it is seeing the 1 in 15 and telling me that 1 exists in
that list.
cfif #listcontains(#pick_list#,1,,)#
any way to have it look for 15 specifically, and not 1
ListFind
-Original Message-
From: Wurst, Keith D. [mailto:[EMAIL PROTECTED]
Sent: 01 August 2003 16:11
To: CF-Talk
Subject: listcontains
i have a list like this...
15,0,2,5
when i run a listcontains on it for the number 1 - i get back a positive
response. i guess it is seeing the 1
Try listfind instead
-Original Message-
From: Wurst, Keith D. [mailto:[EMAIL PROTECTED]
Sent: 01 August 2003 16:11
To: CF-Talk
Subject: listcontains
i have a list like this...
15,0,2,5
when i run a listcontains on it for the number 1 - i get back
a positive
response. i
listfind
-Original Message-
From: Wurst, Keith D. [mailto:[EMAIL PROTECTED]
Sent: Friday, August 01, 2003 10:11 AM
To: CF-Talk
Subject: listcontains
i have a list like this...
15,0,2,5
when i run a listcontains on it for the number 1 - i get back a positive
response. i guess
Help!
When I'm looping over a list Campaign.Vehicles that's coming from a SQL
table varchar field I'm getting strange results from ListContains.
Looping over Vehicles.code=
siteMinute,siteNews,site,siteSpin,mi,os,ol,mn,siteHome - several rows from
a database call.
Campaign.Vehicles=siteMinute
ListCOntains returns the index, not the # of matches.
===
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia
Email: [EMAIL PROTECTED]
Yahoo IM : morpheus
My ally is the Force, and a powerful ally
cfoutputinput class=text type=checkbox name=#i#
cfif ListContains(#Vehicles#, #i#)checked/cfif
nbsp;#i#br/cfoutput
/cfloop
Mark Kecko
The Computer Guy
MediaPost Communications
[EMAIL PROTECTED]
http://www.mediapost.com
(203)222-0330 ext309
Imagination is the one weapon in the war against
Looks to me like you ListContains function needs a
delimiter.
ListContains(#Vehicles#, #i#, ,)
Hope that helps.
Kevin
-Original Message-
From: Mark M. Kecko [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 05, 2002 10:43 AM
To: CF-Talk
Subject: ListContains NOT functioning
,siteHome
cfset Vehicles=siteMinute,siteNews,siteSpin
cfloop list=#codes# index=i
cfoutputinput class=text type=checkbox name=#i#
cfif ListContains(#Vehicles#, #i#)checked/cfif
nbsp;#i#br/cfoutput
/cfloop
Mark Kecko
The Computer Guy
MediaPost Communications
[EMAIL PROTECTED
to flood the List BUT ListContains NOT functioning
properly!
Sorry, but... Why does the below code check 4 boxes when there's only 3
items in the List???
Please help!!! This is costing my company a good deal of cash! - Just
copy
and paste the code into a test page and run it, you'll see, I hope
The function (ListContains) is doing exactly what it's suppose to and I
can
see why it's returning 4.
ListContains: Returns the index of the first item that contains a
specified
substring. The search is case-sensitive. If the substring is not found
in
the list items, it returns zero (0
Mark,
You want to use ListFind(), not ListContains() in your example below.
ListContains() is going to return a position for site since site is
contained in siteMinute, siteNews, site and siteSpin. ListFind()
will only find matching values. ListContains() will return a match if
the string being
I think you may want to use ListFind instead. That will generate the
intended result, I believe. ListFind checks the entire list element
whereas ListContains looks at any part of a list element.
-Original Message-
From: Mark M. Kecko [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 05
You want ListFind()
:-)
- Original Message -
From: [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Wednesday, March 06, 2002 7:57 AM
Subject: RE: Sorry to flood the List BUT ListContains NOT functioning
properly!
Isn't it because spin IS contained in the list? in siteSpin
Carlo,
ListContains works correctly as described in the Language reference. For
what you want, check out ListFind and ListFindNoCase.
Nelson
- Original Message -
From: van Wyk, Carlo [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Wednesday, September 19, 2001 5:27 AM
Subject
://www.bibleclicks.com
- Original Message -
From: David Burt [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Wednesday, September 19, 2001 7:53 AM
Subject: Re: Listcontains question
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
Carlo,
Try adding the delimiter:
listcontains(newlist, #pageid#, ,)
van Wyk, Carlo wrote:
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
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
Hi Carlo,
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#
(snipped)
Try using ListFind instead of ListContains. ListContains
You should use ListFind rather than ListContains
--- van Wyk, Carlo [EMAIL PROTECTED]
wrote:
cfif listcontains(newlist, #pageid#)
cfinclude template=#page#
cfelse
cfoutput
#application.securityerror#
/cfoutput
/cfif
Regards
Carlo
=
I-Lin
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
Try using a structure and using Struct Funtions like Find, Get etc...
~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives:
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.
This code should be what you need:
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
Good morning,
The ListContains function does not work as you wish it to. You should use
the ListFind and ListFindNoCase functions. Here is what the docs say about
ListFind. I use this quite a bit.
ListFind
Returns the index of the first occurrence of a value within a list. Returns
0
);
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
Yes listcontains will do this!
What you might need to do is something like this:-) Turn the list into
an array, then run a loop until you find the first occurrence.
Regards,
Andrew Scott
-Original Message-
From: van Wyk, Carlo [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 19 September
Try using the listFind() function instead.
-Tyson
-Original Message-
From: van Wyk, Carlo [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 19, 2001 4: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
. #application.securityerror#
15. /cfoutput
17. /CFIF
18. /CFLOOP
From: van Wyk, Carlo [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Subject: Listcontains question
Date: Wed, 19 Sep 2001 11:27:54 +0200
Hi
I have the following piece of code that checks to see
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)
cfoutputindex: #index#br
index2: #index2
for that type of comparison, you might be better served staying away from
the listfind or listcontains functions.
try something like
cfset authorized = false
cfloop list=#newlist# index=accessiblePage
cfif accessiblePage eq pageid
cfset authorized = true
/cfif
Use ListFind() instead
---
Billy Cravens
Web Development, EDS
[EMAIL PROTECTED]
-Original Message-
From: van Wyk, Carlo [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 19, 2001 4:28 AM
To: CF-Talk
Subject: Listcontains question
Hi
I have the following piece of code
Hmmm, I think you found a bug!
regards
Andrew Scott
Senior Cold Fusion Application Developer
ANZ eCommerce Centre
* Ph 9273 0693
* [EMAIL PROTECTED]
-Original Message-
From: Park, Simon [mailto:[EMAIL PROTECTED]]
Sent: 01 December 2000 06:47
To: CF-Talk
Subject: ListContains
No, this isn't a bug.
According to the documentation, ListContains returns the index of the first
list element THAT CONTAINS THE SPECIFIED SUBSTRING.
Your code returns true because the substring "1" is contained in the list
element "10".
So it doesn't really do what you
an element in
this example
regards
Andrew Scott
Senior Cold Fusion Application Developer
-Original Message-
From: BORKMAN Lee [mailto:[EMAIL PROTECTED]]
Sent: 04 December 2000 12:06
To: CF-Talk
Subject: RE: ListContains wierdness - why?
No, this isn't a bug.
According to the documentation, Li
It's not a bug. If it worked the same as ListFind() what would be the point
of the function? I honestly can't think of a good use for the
ListContains() function, but that's another matter. It certainly seems to
cause more confusion than anything.
Jim
- Original Message -
From
: ListContains wierdness - why?
It's not a bug. If it worked the same as ListFind() what would be the point
of the function? I honestly can't think of a good use for the
ListContains() function, but that's another matter. It certainly seems to
cause more confusion than anything.
Jim
- Original
Try using a listfind instead of a listcontains, then re-read the help pages
for both functions carefully.
Jared Clinton.
-Original Message-
From: Park, Simon [mailto:[EMAIL PROTECTED]]
Sent: Friday, 1 December 2000 6:47
To: CF-Talk
Subject: ListContains wierdness - why?
Why
Because there's a "1" in the list, in the value "10". Try ListFind
rather than ListContains.
-David
On Thu, 30 Nov 2000 14:47:29 -0500 "Park, Simon" [EMAIL PROTECTED] writes:
Why does the following always return TRUE?
CFSET FooList = "6,7,8,9,10"
Simon,
You want ListFind. ListContains returns true because the list contains a
"1" ... it's part of the "10"
i.e. ListFind to find list elements, ListContains to find substrings within
elements.
-Rob
-Original Message-
From: Park, Simon [mailto:[EMAIL PROT
Try ListFind
At 2:47 PM -0500 11/30/00, Park, Simon wrote:
Why does the following always return TRUE?
CFSET FooList = "6,7,8,9,10"
CFIF ListContains(VARIABLES.FooList, "1")
TRUE
CFELSE
FALSE
/CFIF
Do I need to put the
Hi Simon,
Why does the following always return TRUE?
CFSET FooList = "6,7,8,9,10"
CFIF ListContains(VARIABLES.FooList, "1")
ListContains() searches for substrings in the list so it is true, there is
a "1" in the list part of the "10". Us
Why does the following always return TRUE?
CFSET FooList = "6,7,8,9,10"
CFIF ListContains(VARIABLES.FooList, "1")
TRUE
CFELSE
FALSE
/CFIF
You are about to discover the difference between
ListContains and ListFind.
ListContains will return true if substring
a comma and a zero.
"Park, Simon" wrote:
Why does the following always return TRUE?
CFSET FooList = "6,7,8,9,10"
CFIF ListContains(VARIABLES.FooList, "1")
TRUE
CFELSE
FALSE
/CFIF
Do I need to put the values into an array?
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
00 9:12 AM
To: CF-Talk
Subject: Re: ListContains wierdness - why?
As a general rule, arrays are more efficient than lists.
Lists are implemented as strings, so every action on them is
done as string processing. Arrays are implemented natively.
Based on that (Without actual
[EMAIL PROTECTED]
http://www.crescotech.com
-Original Message-
From: Jeffry Houser [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 01, 2000 9:12 AM
To: CF-Talk
Subject: Re: ListContains wierdness - why?
As a general rule, arrays are more efficient than lists.
Lists are implemented
Why does the following always return TRUE?
CFSET FooList = "6,7,8,9,10"
CFIF ListContains(VARIABLES.FooList, "1")
TRUE
CFELSE
FALSE
/CFIF
Do I need to put the values into an array?
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Simon Park Computer Sys
58 matches
Mail list logo