Solved

Error when trying to access page written in coldfusion

Posted on 2009-04-02
8
239 Views
Last Modified: 2013-12-24
I have a CMS that was written by someone else in coldfusion. When I try to go to the User Management/Group Permissions component it give me this error.

"Invalid list index 2448.  
In function ListGetAt(list, index [, delimiters]), the value of index, 2448, is not a valid as the first argument (this list has 2447 elements). Valid indexes are in the range 1 through the number of elements in the list.  
 
The error occurred in C:\Inetpub\wwwroot\siteadmin\userMgmt\selectBoxMove.cfm: line 70
Called from C:\Inetpub\wwwroot\siteadmin\userMgmt\selectBoxMove.cfm: line 60
Called from C:\Inetpub\wwwroot\siteadmin\userMgmt\selectBoxMove.cfm: line 1
Called from C:\Inetpub\wwwroot\siteadmin\userMgmt\groupForm.cfm: line 387
Called from C:\Inetpub\wwwroot\siteadmin\userMgmt\groupForm.cfm: line 1
 
68 :                                     <cfset j=i+1>
69 :                                     <cfset val = Trim(ListGetAt(ATTRIBUTES.leftFieldList,i,ATTRIBUTES.listDelimeter))>
70 :                                     <option value="#val#"<cfif ATTRIBUTES.boldNegative AND Left(val,1) EQ "-"> style="font-weight:bold;color:##0000FF;"</cfif><cfif colorCount mod 2> style="background-color:##F4F4F4"</cfif>>#ListGetAt(ATTRIBUTES.leftFieldList,j,ATTRIBUTES.listDelimeter)#</option>
71 :                                     <cfset colorCount = colorCount + 1>
72 :                               </cfloop>"

I am not familiar with coldfusion. Any ideas?
0
Comment
Question by:J C
  • 6
  • 2
8 Comments
 
LVL 16

Expert Comment

by:duncancumming
ID: 24055282
Well basically the value for 'j' is too high.  

Your list, attrributes.leftFieldList has 2447 items (big list!) .  You're looping round something, can't tell what, we'd need the line of code somewhere above this that starts <cfloop..... >  Inside the loop you're adding 1 to a counter, 'j'.  You then try and access the j-th element from the leftFieldList each time round the loop, i.e. first time round get the 1st item from the leftFieldList; second time round get the 2nd item from the leftFieldList, and so on.  

For some reason j is too large, but without the <cfloop> line that's missing from your code     posted above, I couldn't say why that is.  
0
 
LVL 27

Expert Comment

by:azadisaryev
ID: 24056416
omg, you have a select box with 2447 options in it?????
i do not want to be a user of this application...

more to the point - duncan is correct in all he says.
what i find strange in your code is: the <option> tag has a VALUE of list element X value, but displays as TEXT the value of list element X+1 ... strange why you want to do that....
for starters, see if this is just a typo in the code, and "j" in the below line should really be "i":

#ListGetAt(ATTRIBUTES.leftFieldList,j,ATTRIBUTES.listDelimeter)#</option>
change j in the above to i:
#ListGetAt(ATTRIBUTES.leftFieldList,i,ATTRIBUTES.listDelimeter)#</option>

also, it looks like your even OPTION tags may end up having 2 STYLE attributes defined - that's no good.
change this:

<option value="#val#"<cfif ATTRIBUTES.boldNegative AND Left(val,1) EQ "-"> style="font-weight:bold;color:##0000FF;"</cfif><cfif colorCount mod 2> style="background-color:##F4F4F4"</cfif>>
to this:

<option value="#val#" style="<cfif ATTRIBUTES.boldNegative AND Left(val,1) EQ "-"> font-weight:bold;color:##0000FF;</cfif><cfif colorCount mod 2>background-color:##F4F4F4;</cfif>">

Azadi
0
 
LVL 27

Expert Comment

by:azadisaryev
ID: 24056440
ok, scrap that, i see what the code is doing now... of course i saw it the instance i pressed the 'submit' button on my previous comment...

it looks like your ATTRIBUTES.leftFieldList list contains both values and display tags for your <option> tags - that's why the value of the option is list element X and the display text is list element X+1.

my guess would be that what is happening, is some element in your list is empty - and CF skips empty list elements when dealing with lists. wherever and however that list is created, you need to make sure it does not contain any empty elements.

Azadi
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 27

Expert Comment

by:azadisaryev
ID: 24056447
> values and display tags

should be "values and display TEXT"

Azadi
0
 
LVL 16

Expert Comment

by:duncancumming
ID: 24057238
just noticed this:
<cfset j=i+1>

it's kind of an odd thing to see, normally you'd see
<cfset i=i+1>
or
<cfset j=j+1>

i think we need to see more code.  are there nested loops?
0
 
LVL 27

Expert Comment

by:azadisaryev
ID: 24057842
guess: the loop that we do not see iterates over the list with step="2", then the j var is used to get the next list element after the current one...

Azadi
0
 
LVL 27

Accepted Solution

by:
azadisaryev earned 500 total points
ID: 24057893
@jleecole:

to debug this issue, before your <cfloop> tag (which we need to see, but you didn;t post) add this code:

(assuming the ATTRIBUTES.leftFieldList list is comma-delimited)

<cfif find(ATTRIBUTES.leftFieldList, ",,") OR left(ATTRIBUTES.leftFieldList, 1) is "," OR right(ATTRIBUTES.leftFieldList, 1) is ",")>
<p>ERROR! List ATTRIBUTES.leftFieldList contains empty elements! Aborting...</p>
<cfdump var="#ATTRIBUTES.leftFieldList#" label="ATTRIBUTES.leftFieldList list">
<cfabort>
</cfif>

if your ATTRIBUTES.leftFieldList list is NOT comma-delimited - replace all "," and ",," in the above code with your list delimiter.

this code will stop further processing of the page if the list contains empty elements and show the the list contents so you can inspect it and figure out where the empty elements are coming from...

Azadi
0
 
LVL 27

Expert Comment

by:azadisaryev
ID: 24073985
@jleecole: how is it going with this issue? do you need more help?

Azadi
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Domino Load Balancer For 2048 Key Requirement 7 40
DNS, website, godaddy 6 84
spamming  on Hosted svrs? 6 90
Stream live video from Raspberry Pi camera 22 153
Drupal 5.x currently does not have a production-ready patch bundle to allow for split read & writes for a MySQL master/slave replication setup. After reading a open discussion/thread on the Drupal site (http://drupal.org/node/147160 (http://drupal.o…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question