Saving Coldfusion Line Breaks and Returns

Hello, I am trying to save a cftextarea to an MSSQL database with datatype VarChar for Project_Justification.

When I submit the form, the record is saved to the database but the line returns are lost, no BR tages are saved to the dB and they are lost when displaying.

I need to maintain the line returns when displaying the record as part of an edit field so my paragraphs are not bunched together....

My Input Form:
 <label class="textarea">
<span class="text1">Project Justification </span>
<cfif isdefined("URL.ID")>
<cftextarea name="Project_Justification" value="#Capital_Project.Project_Justification#"></cftextarea>
 <cftextarea name="Project_Justification"></cftextarea>

My Input Query:
<cfset Project_Description=replace("#FORM.Project_Justification#",chr(13)&chr(10),"<br />","all")>

<cfquery name="Insert_Project" datasource="#application.dsn#">
INSERT INTO Capital_Projects
VALUES (      '#FORM.Project_Justification#')
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

midhelpdeskAuthor Commented:
It seems to be something with my CFServer? I tested on my internet server and it works fine.
Testing on my intranet server and it doesn't work.

Something with my intranet server configuration that isn't allowing it to work?? WTH? lol
Well for one thing look what you have here:
<cfset Project_Description=replace("#FORM.Project_Justification#",chr(13)&chr(10),"<br />","all")>
You are adding BR tags to Project_Description NOT to form.Project_Justification!

Then you are inserting form.Project_Justification to the DB - You should be inserting Project_Description which is actually variables.Project_Description (I believe in scoping everything)
<cfquery name="Insert_Project" datasource="#application.dsn#">
INSERT INTO Capital_Projects
VALUES (      '#FORM.Project_Justification#')

Also if still having issues you might want to check to see if your carriage returns ( chr(13) & chr(10) ) do exist in your form.Project_Justification ...
midhelpdeskAuthor Commented:
thanks for the comment. I have corrected this and it seems to work fine on my Internet Server. Running the app on the Internet server doesn't work. It's the oddest thing. My guess is permissions or some sort of mapping that is the issue?

I needed to move that server to 2012 so now is a good time. I expect that should resolve the issue. Will post after migration is finished.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I'm just checking in to see if you got it working or if you needed additional help.

midhelpdeskAuthor Commented:
Reloaded server.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.