Solved

Error when trying to access page written in coldfusion

Posted on 2009-04-02
8
234 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 27

Expert Comment

by:azadisaryev
Comment Utility
> values and display tags

should be "values and display TEXT"

Azadi
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 16

Expert Comment

by:duncancumming
Comment Utility
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
Comment Utility
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
Comment Utility
@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
Comment Utility
@jleecole: how is it going with this issue? do you need more help?

Azadi
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Script 12 114
wordpress email form 23 67
JKS to store upstart data 2 64
Change local server setting in php 6 58
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…
In this article, we will look at our content management system as a whole, to get an idea of how we will start to manage these content items.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now