you could cfparam it and use Len().
Won
-----Original Message-----
From: John Stanley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 14, 2000 2:14 PM
To: CF-Talk
Subject: Alternative or Workaround to IsDefined
I have a page that may or may not receive a variable from a referring
template. The page is supposed to query a database and compare it's results
to do a check with the following code:
counter refers to a value that is passed regarding the total number
of hidden fields possible
hiddenfield(one through counter) are the actual hidden fields
<cfloop index="saveindex" from="1" to="#counter#">
<cfset temp_hidden = "hiddenfield#saveindex#">
<cfset temp_hidden = #Evaluate(temp_hidden)#>
<cfquery name="get_temp_object"
datasource="#sharecaredatasource#">
select *
from page_edit_settings
where screen_id = #rpt_num#
and objectname = '#temp_hidden#'
</cfquery>
<cfset temp = #replace(get_temp_object.objectname,'
','',"all")#>
<cfif isDefined("#temp#")>
<cfset donotprint = 1>
<cfelse>
<cfset donotprint = 0>
</cfif>
....more code...
</cfloop>
--->>>> this code works fine and dandy until you introduce a weird
character like a "-" or a single quote for the object name that is returned
by the query. The value is getting passed as you can see below; but then you
get the following error message:
Parameters
URL Parameters:
HIDDENFIELD5=Mental Status'DO NOT USE
MENTALSTATUS'DONOTUSE=on
PHY_NME=/screens/atp/newintake.cfm
VERIFICATIONOFPERSONCENTEREDPLANNING=on
ERROR MESSAGE:
An error occurred while evaluating the expression:
isDefined("#temp#")
Error near line 171, column 9.
Parameter 1 of function IsDefined which is now
"MentalStatus'DONOTUSE" must be a syntactically valid variable name
QUESTION: Is there another function that will check for the existance of a
variable passed through the URL that is not so restrictive in the sysntax it
allows ? I need to be able to let my clients enter whatever special
characters they need for these fields. I do not think ParameterExists will
work because the variable temp will need to be set dynamically, and
therefore will exist, causing the function to return true every time. I have
tried urlencodedformat by addingthe following code (<cfset temp =
#urlencodedformat(temp)#>) and recieve the following error message:
ERROR MESSAGE:
An error occurred while evaluating the expression:
isDefined("#temp#")
Error near line 171, column 9.
Parameter 1 of function IsDefined which is now
"MentalStatus%27DONOTUSE" must be a syntactically valid variable name
Any help would be appreciated.
Thanks in advance,
John Stanley
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists