It's not returning whitespace, the method itself is generating whitespace.
You need to specify output="false" in the CFFUNCTION tag and the CFCOMPONENT
tag.  That will prevent anything from being output by the method.

In general, CFFUNCTION should always have that attribute set.  The only
exception would be if your CFC is designed to generate output (html) for the
client.

Cheers,
barneyb

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Mark M
> Sent: Monday, February 02, 2004 4:54 PM
> To: [EMAIL PROTECTED]
> Subject: [CFCDev] Weird Line breaks on get() methods
> 
> Hey all
> 
> (Apologies for the cross post to cfaussie, but that list is 
> running like a dog today.. so are all of 
> daemon's servers it seems)
> 
> I got a weird one - 
> 
> If you have:
> 
> --- myObj.cfc ---
> <cfcomponent>
> 
>       <cfscript>
>               instance = Structnew();
>               instance.myVar = "";
>       </cfscript>
> 
>       
>       <cffunction name="getMyVar" access="public" returntype="string">
>               <cfreturn instance.myVar>
>       </cffunction>
> </cfcomponent>
> --------------------
> 
> and you run:
> 
> --- index.cfm ---
> <html>
> <head>
> <title></title>
> </head>
> <body>
> 
>       <cfscript>
>               o = createObject("component", "myObj");         
>       </cfscript>
>       
>       <cfoutput>
>       <pre>
>       [#o.getMyVar()#]
>       </cfoutput>
>       </pre>
> 
> </body>
> </html>
> --------------------
> 
> You end up with an output of:
> 
> --------
>       [
>                   ]
> --------
> 
> when you should be getting
> --------
>       []
> --------
> 
> i.e. - You have these line breaks in the string, when the 
> string (instance.myVar = "";) doesn't 
> have any line breaks.
> 
> Which means when you:
> 
> <input type="text" value="#o.getMyVar()#">
> 
> will output as
> 
> <input type="text" value="
>            "> 
> 
> With obvious annoying implications.
> 
> I've tried all manner of stripcr(), and trim() to solve this 
> issue, but has anyone else come 
> across this?
> 
> I'm totally at a loss.
> 
> Thanks in advance.
> 
> Mark
> ------------------------------------------------------------------
> [EMAIL PROTECTED]
> ICQ: 3094740
> Safe From Bees
> [ www.safefrombees.com ]
> 
> 
> 
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
> in the message of the email.
> 
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
> 
> An archive of the CFCDev list is available at 
> www.mail-archive.com/[EMAIL PROTECTED]
> 

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to