Solved

Error when trying to access page written in coldfusion

Posted on 2009-04-02
8
246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
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

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
What You Need to Know when Searching for a Webhost Provider
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

734 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