Not to be too picky about things, but (imho) there is no such thing as a
'legitimate' angle bracket in an input's Value attribute.  According to the
HTML spec, angle brackets, quotes, and ampersands in html tag attibutes
'should be' replaced with their entity references (granted, the angle
brackets are replaced mainly to support old/broken implementations):
http://www.w3.org/MarkUp/html-spec/html-spec_foot.html#FOOT7

Note that failure to escape ampersands in HREF attributes can sometimes
cause unpredictable things to occur in some versions of Netscape-- for
example, <a href="somepage.cfm?voltage=100&amperage=5"> will take the "&amp"
out of context and change the URL, when clicked, to
"somepage.cfm?voltage=100&erage=5".  Which is part of the reason I prefix
all form fields and url parameters with "ff".  Of course, you could make it
a point to always use "&amp;" when seperating parameters in HREF attributes,
but I personally don't have that kind of patience.

(More suggestions on entity references:
http://www.w3.org/TR/REC-html40/charset.html#h-5.3.2
--not singled out in that doc is "&apos;", which escapes the single quote
character.  For an exhaustive (and exhausting!) list of HTML4 entity
references, see:
http://www.w3.org/TR/REC-html40/sgml/entities.html
)

Also, htmlEditFormat in CF5 no longer "eats" carriage returns, though it's
still documented as doing so.  (Shhh!)

I guess the rule of thumb ("according to Daryl") is to always use
htmlEditFormat() when redisplaying user-entered values in HTML form input
fields (when using CF5.)

--Daryl

----- Original Message -----
From: "Ron Hornbaker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 28, 2002 5:00 PM
Subject: RE: [KCFusion] How to preserve "&lt;" and "&gt;" strings... (was:
Text box value)


Daryl,

Well slap my a** and call me Sally. I'm actually doing this with ASP at
the moment, and since it doesn't (to my knowledge) have a fn comparable to
htmlEditFormat, I didn't actually try it with CF first. My apologies to
the group. :)

BTW, the ASP fix is like so: Replace(objRS("body"),"&","&amp;") when
writing the KB article body to the textarea. Even with CF, the
htmlEditFormat() fn is a little too several for my purpose, since it also
escapes legitimate < and > marks, and strips carriage returns.

-Ron

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Daryl Banttari
> Sent: Monday, January 28, 2002 4:50 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [KCFusion] How to preserve "&lt;" and "&gt;" strings...
> (was: Text box value)
>
>
> If you use htmlEditFormat, then the string "&gt;" will be sent to the
> browser as &amp;gt;
>
> So, it should work just fine.  Doesn't it?
>
> If not, please post the snippet in question.
>
> Thanks!
>
> --Daryl
>
> ----- Original Message -----
> From: "Ron Hornbaker" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, January 28, 2002 3:26 PM
> Subject: [KCFusion] How to preserve "&lt;" and "&gt;"
> strings... (was: Text
> box value)
>
>
> > Use the htmlEditFormat() function around the value.
> >
> > Value="#htmlEditFormat("""" & someValue & """")#"
> >
> > This will replace the double quotes with "&quot;", as needed.
>
> Speaking of htmlEditFormat, here's a question for you. Say you've got a
> textarea where users can enter a combination of text and html.
> A knowledge
> base system, for the sake of argument. The user decides to enter some
> displayed code, like this:
>
>  This is how to <b>bold</b> a word: &lt;b&gt;bold&lt;/b&gt;
>
> The user saves the record, and so far so good. Now comes time
> to edit the
> article, and here's where it gets ugly... MSIE will display the
> "&lt;" and
> "&gt;" strings as actual brackets in the text area, so the article now
> looks like this in the textarea input box:
>
>  This is how to <b>bold</b> a word: <b>bold</b>
>
> and when the user re-saves the article, they of course get switched back
> to real brackets.
>
> Any workarounds would be appreciated...
>
> -Ron



______________________________________________________________________
The KCFusion.org list and website is hosted by Humankind Systems, Inc.
List Archives........ http://www.mail-archive.com/cf-list@kcfusion.org
Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED]
To Subscribe.................... mailto:[EMAIL PROTECTED]
To Unsubscribe................ mailto:[EMAIL PROTECTED]



 
 
______________________________________________________________________
The KCFusion.org list and website is hosted by Humankind Systems, Inc.
List Archives........ http://www.mail-archive.com/cf-list@kcfusion.org
Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED]
To Subscribe.................... mailto:[EMAIL PROTECTED]
To Unsubscribe................ mailto:[EMAIL PROTECTED]
 

Reply via email to