Solved

Element is undefined in a Java object of type class coldfusion.filter.UrlScope.

Posted on 2009-05-13
2
980 Views
Last Modified: 2012-05-06
The body of code below thows the following error:

Element 10 is undefined in a Java object of type class coldfusion.filter.UrlScope.  
 
 
The error occurred in C:\nwmdev\apache\Apache2\htdocs\workspace\pdm\fusebox\login.cfm: line 51
 
49 : <cfloop collection="#url#" item="i">
50 :             <cfif NOT ListFindNoCase(ListIgnore, i, ",") and isAlphaNumeric(i)>
51 :                   <cfset uRow = listAppend(uRow,"#LCase(i)#/#LCase(URL[i])#","/")>
52 :             </cfif>
53 : </cfloop>
 
Note that the URL struct when dumped looks something like this::

struct
/WWW.SAFWE.COM WIDTH=900 HEIGHT=1100>:: [empty string]  
ERROR:: [empty string]  
FUSE:: login  
REDIRECT:: [empty string]  
REINIT:: false  
SUBMITTED:: &amp;gt;&amp;#x22;&amp;gt;&amp;lt;/title&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/form&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;br&amp;gt;&amp;lt;iFraMe src=http:/  

Can anyone help me find the reason for this error.

// Returns true if the string only contains alpha numeric characters (empty string = true)
function isAlphaNumeric(txt) {
	return ValidString(txt,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789');
}
 
// Returns true if the CheckString only contains characters passed in ValidString (empty string = true)
function ValidString(ChkString,ValidString) {
	for (i=1; i LTE Len(ChkString); i=i+1) {
		if (FindNoCase(Mid(ChkString,i,1), ValidString) eq 0) return false;
	}
	return true;
}
</cfscript>
 
 
<cfloop collection="#url#" item="i">
		<cfif NOT ListFindNoCase(ListIgnore, i, ",") and isAlphaNumeric(i)>
			<cfset uRow = listAppend(uRow,"#LCase(i)#/#LCase(URL[i])#","/")>
		</cfif>
</cfloop>

Open in new window

0
Comment
Question by:onaled777
[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
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 24378816
It is probably a scoping clash.  In your function you are using a variable named "i" and also using that same variable name as your <cfloop> index. Since your function variables are not properly scoped, ValidString ends up overwriting or clashing with your cfloop index.

_Always_ var scope _all_ function local variables.  In other words, if a variable is only used in the function, place it in the VAR scope.  Also, you might consider using the newer cffunction syntax instead. It has some benefits over the old udf syntax.

// Returns true if the CheckString only contains characters passed in ValidString (empty string = true)
function ValidString(ChkString,ValidString) {
      var i = 0;
        for (i=1; i LTE Len(ChkString); i=i+1) {
                if (FindNoCase(Mid(ChkString,i,1), ValidString) eq 0) return false;
        }
        return true;
}
</cfscript>

Open in new window

0
 

Author Comment

by:onaled777
ID: 24379140
THANK YOU SO MUCH!
0

Featured Post

Create CentOS 7 Newton Packstack Running Keystone

A bug was filed against RDO for the installation of Keystone v3. This guide is designed to walk you through the configuration for using Keystone v3 with Packstack. You will accomplish this using various repos and the Answers file.

Question has a verified solution.

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

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

627 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