Solved

Error when trying to access page written in coldfusion

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

Expert Comment

by:azadisaryev
ID: 24056447
> values and display tags

should be "values and display TEXT"

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

911 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

22 Experts available now in Live!

Get 1:1 Help Now