Dear Jamie,

Please try the below code to emulate a 'cfparam' from within a 'cfscript'
block


<!---begin test code---->
<!---
Try the following code with
        1. the //myVar =2; line commented out, result should be myVar has a
value of '1'
        2. the //myVar =2; line uncommented, result should be myVar has a
value of '2'
--->

<cfscript>
        //myVar = 2;

        mydefaultValue = 1;
        
iif(isdefined('myVar'),"de('')","setvariable('myVar',myDefaultValue)");
        
</cfscript>

<cfoutput>
        #myVar#
</cfoutput>
<!---end test code---->

Good luck,
Jared Clinton
Software Engineer
Maxi Multimedia
NEC Australia.

> -----Original Message-----
> From: Patricia Lee [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 18 May 2001 7:34
> To: CF-Talk
> Subject: RE: EnableCFoutputOnly not cutting the mustard in Custom Tag
> 
> 
> 1) Nope... as of yet no way to do a cfparam inside of 
> cfscript.  That whole
> limitation of only function calls valid from within cfscript 
> and all.  As of
> my knoweldge this still is the case in cf 5.
> 
> 2) I also believe this is nope.  Check my post (came in just 
> after your
> self-posted solution).
> 
> |-----Original Message-----
> |From: Jamie Jackson [mailto:[EMAIL PROTECTED]]
> |Sent: Thursday, May 17, 2001 4:40 PM
> |To: CF-Talk
> |Subject: Re: EnableCFoutputOnly not cutting the mustard in Custom Tag
> |
> |
> |Actually, if I modify the code as follows, I can get rid of the space
> |(smash all the preceding and following tags together). However, this
> |brings up another question that I asked a while ago: Is 
> there still no
> |slick way to do a <cfscript> version of <cfparam>? Also, is the
> |smashing together of tags (a bit  messy) the only way to 
> accomplish my
> |original goal?
> |
> |Here is the working code:
> |
> |<cfsetting enableCFoutputOnly="yes"><cfparam name="1"
> |default=""><cfparam name="2" default=""><cfparam name="3"
> |default=""><cfscript>
> |FinalValue = result_of_a_bunch_of_processing;
> |writeOutput(FinalValue);
> |</cfscript><cfsetting enableCFoutputOnly="no">
> |
> |Thanks,
> |Jamie
> |
> |On Thu, 17 May 2001 16:01:09 -0400, Jamie Jackson 
> <[EMAIL PROTECTED]>
> |wrote:
> |
> |>I've got a custom tag which returns a small string, but I can't get
> |>rid of the extra spaces around the string when it's called. This has
> |>screwed me up several times, and I haven't found a solution yet.
> |>EnableCFoutputOnly gets rid of most of the garbage 
> whitespace, but it
> |>leaves a space to the left and right of the desired output string.
> |>
> |>####### Custom Tag ########
> |><cfsetting enableCFoutputOnly="yes">
> |><cfscript>
> |>FinalValue = result_of_a_bunch_of_processing;
> |>writeOutput(FinalValue);
> |></cfscript>
> |><cfsetting enableCFoutputOnly="no"
> |>
> |>####### Calling Script ########
> |>FinalValue = "<cf_MyCustomTag>"
> |>
> |>###### Results in Browser ######
> |>FinalValue = " result_of_a_bunch_of_processing "
> |>
> |>But, I would like to see:
> |>FinalValue = "result_of_a_bunch_of_processing"
> |>
> |>See those spaces that show up? What's causing them? How do I get rid
> |>of them?
> |>
> |>Obviously there are workarounds, such as:
> |>*Send the string back to the calling script with caller.FinalValue
> |>
> |>However, I would like to know if this can work without going the
> |>caller-scope route.
> |>
> |>Thanks,
> |>Jamie
> |>
> |>
> |
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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

Reply via email to