Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Error when trying to access page written in coldfusion

Posted on 2009-04-02
8
Medium Priority
?
256 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
Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

 
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 2000 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

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

610 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