Flash Forms and ParagraphFormat

A user recently sent in this problem: They noticed that if they paragraphFormatted the result of an HTML textarea, they got nicely formatted results. If they did the same thing with a Flash Form textarea, it didn’t work.

The paragraphFormat function is relying on particular character codes to represent the end of a line. I did a quick test where I replaced all chr(13) with 13s, and all chr(10) with 10s. Turns out on the HTML form, my line breaks were chr(13)chr(10). In the Flash Form, they were just chr(13).

I suggested this simple fix:

<cfset form.comments2 = replace(form.comments, chr(13), chr(13) & chr(10), "all")>

And it seemed to do the trick. One word of warning - if I remember right, the character codes you get from a text area are both OS and browser dependent. This is probably less an issue with Flash Forms however.

p.s. One more reason to not use Flash Forms and just pick up Flex 2. :)

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments