EasyCFM.COM ColdFusion Forums / MS Access Related Issues / Text Area Proper Handling

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Text Area Proper Handling

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

StoneRose
02-06-2010 @ 7:59 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 80
Joined: Dec 2008

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
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 773
Joined: Apr 2003

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
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 80
Joined: Dec 2008

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
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 935
Joined: Jun 2007

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
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 80
Joined: Dec 2008

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


Website Designed and Developed by Pablo Varando.