Solved

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

Posted on 2009-05-13
2
954 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
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

930 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

8 Experts available now in Live!

Get 1:1 Help Now