Topic: Text Area Proper Handling


StoneRose    -- 02-06-2010 @ 7:59 PM
  What's the right way to insert text area info into the DB to maintain the multip-line formatting?  (Anything special on display?)

This message was edited by StoneRose on 2-6-10 @ 8:04 PM


nmiller    -- 02-07-2010 @ 12:48 PM
  when inserting into the database, decide if you want html
in the database.  If so, do this:

replace(form.whatever,chr(13),"<br/>","all"))

then the opposite when editing inside a textarea.


Nathan Miller
NM Consulting


StoneRose    -- 02-07-2010 @ 2:29 PM
  Thank you... didn't know that and it seems better (why doesn't CF just have that as a function)

But overnight I did find a solution (so far) which is
URLEncodedFormat/URLDecode and also ParagraphFormat on display (but don't need it to re-populate the te field, just decode).


dlackey    -- 02-08-2010 @ 8:14 AM
  I've actually never seen that tag before.  I will have to review it more in depth.  I've always used the approach Nathan took but with chr(10) and chr(13) as in


Going into the database
replace(form.variable,chr(10)chr(13),"<br/>","all"))

Coming from the database to the screen
replace(form.variable,"<br/>",chr(10)chr(13),"all"))



Cheers,
Chip


StoneRose    -- 02-08-2010 @ 12:02 PM
  ParagraphFormat

Replaces characters in a string:

    * Single newline characters (CR/LF sequences) with spaces
    * Double newline characters with HTML paragraph tags (<p>)

A copy of the string, with characters converted.



https://www.adobe.com/livedocs/coldfusion/6.1/htmldocs/functa49.htm


EasyCFM.COM ColdFusion Forums : http://archive.easycfm.com/forums
Topic: http://archive.easycfm.com/forums/viewmessages.cfm?Forum=30&Topic=14697