[thelist] RE: [thechat] CFusion- won't parse my page.. dislikes my # sign.. ?

Seth Bienek seth at sethbienek.com
Fri Jul 20 17:16:18 CDT 2001


> Unfortunatly, for the life of me, I can't figure out why it 
> doesen't like this line:
> VALUES('#form.page#', '#form.body_content#', '#form.page_title#')

Hi Charles,

My guess would be that this:
  <CFSET form.bodycontent = Replace(form.bodycontent, ', '')>

Should be this:
  <CFSET form.bodycontent = Replace(form.bodycontent, "'", "''", "ALL")>

Because CF is not picky between single quotes and double quotes, it thinks the second argument for your replace statement is ', ' and that the third argument is everything between the next signle quote and the first hash mark that it finds, so it says "wait a minute, somthing's hosed here!" and barfs.

You can escape single quotes with doubles and vice versa, or by doubling up on the single quotes.  This would also work:
  <CFSET form.bodycontent = Replace(form.bodycontent, '''', '''''')>

Hope this helps,

Seth

PS: This question is better suited for 'thelist'; 'thechat' is for off-topic conversation, mindless banter, etc..

-----------------------------------
Seth Bienek
Digitaris Technologies, Inc.
tel (972) 690-4131, ext. 103
fax (972) 690-0617
icq 7673959
----------------------------------- 


> -----Original Message-----
> From: thechat-admin at lists.evolt.org
> [mailto:thechat-admin at lists.evolt.org]On Behalf Of Charles Wilson
> Sent: Friday, July 20, 2001 5:10 PM
> To: thechat at lists.evolt.org
> Subject: [thechat] CFusion- won't parse my page.. dislikes my # sign.. ?
> 
> 
> I get this error:
> -----
> Invalid parser construct found on line 15 at position 14. 
> ColdFusion was looking at the following
> text:
> #
> Invalid expression format. The usual cause is an error in the 
> expression structure.
> The last successfully parsed CFML construct was a CFSET tag 
> occupying document position (11:3) to
> (11:8).
> 
> ----
> 
> When I run this code:
> 
> 
> <!--- Set url.DO and url.ACTION variables to blank if not set. --->
>     <cfparam name="url.do" default="">
>     <cfparam name="url.action" default="">
>  <cfparam name="form.release_content" default="">
>  <cfparam name="form.file_location" default="">
>  <cfparam name="form.name" default="">
> 
>  <!--- Insert New Content Page --->
>  <cfif (url.do is "yes") AND (url.action is "InsertNewPage")>
>   <CFSET form.bodycontent = Replace(form.bodycontent, ', '')>
>  <CFQUERY name="InsertNewPage" datasource="purplemonkeydishwater">
>    INSERT INTO body_content
>        (page, body_content, page_title)
>      VALUES('#form.page#', '#form.body_content#', '#form.page_title#')
>   </CFQUERY>
> 
> ======
> 
> At first I was confused as to why it would go right through the 
> CFIF and process the code inside it
> (the paramters in the url should make the processing skip over 
> the CFIF statement),
> but now I realize coldfusion is just trying to check out the 
> whole document's tags before it
> actually processes it and walks through the code.
> 

> 
> It seems to be having trouble with the first hash mark.  The SQL 
> is fine, I don't get it..
> 
> I am running Coldfusion 4.5.1 with a Oracle 8? server.
> 
> -charles
> (if you can, please also cc: me at wilsonc at clubhotel.com )
> 
> 
> _______________________________________________
> thechat mailing list
> thechat at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/thechat
> http://lists.evolt.org/thechatarchive/
> 
> 






More information about the thelist mailing list