I guess you could just encode & escape the strings yourself. As you can see
you cannot use ' as part of a variable name nor can you use -, % etc. etc.
This might be a lil' bit time consuming but you can do something like this:
<cfset temp=Replace(temp,"'","_1","ALL")>
That would intially take care of the ' in the variable name & replace it
with _1. Then if you ever needed to replace the _1 back into a ', just
change the code on below inside the processing page. Now you could go on a
numbering scheme here for every invalid character so ! = _1, @ = _2, # = _3
so on & so forth.
HTH,
Mike
>From: John Stanley <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: CF-Talk <[EMAIL PROTECTED]>
>Subject: Alternative or Workaround to IsDefined
>Date: Thu, 14 Dec 2000 14:14:04 -0500
>
>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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists