midhelpdesk
asked on
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_Justificatio n" value="#Capital_Project.Pr oject_Just ification# "></cftext area>
cfelse>
<cftextarea name="Project_Justificatio n"></cftex tarea>
</cfif>
</label>
My Input Query:
<cfset Project_Description=replac e("#FORM.P roject_Jus tification #",chr(13) &chr(10)," <br />","all")>
<cfquery name="Insert_Project" datasource="#application.d sn#">
INSERT INTO Capital_Projects
(Project_Justification)
VALUES ( '#FORM.Project_Justificati on#')
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_Justificatio
cfelse>
<cftextarea name="Project_Justificatio
</cfif>
</label>
My Input Query:
<cfset Project_Description=replac
<cfquery name="Insert_Project" datasource="#application.d
INSERT INTO Capital_Projects
(Project_Justification)
VALUES ( '#FORM.Project_Justificati
Well for one thing look what you have here:
<cfset Project_Description=replac e("#FORM.P roject_Jus tification #",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_Descript ion (I believe in scoping everything)
<cfquery name="Insert_Project" datasource="#application.d sn#">
INSERT INTO Capital_Projects
(Project_Justification)
VALUES ( '#FORM.Project_Justificati on#')
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 ...
<cfset Project_Description=replac
You are adding BR tags to Project_Description NOT to form.Project_Justification
Then you are inserting form.Project_Justification
<cfquery name="Insert_Project" datasource="#application.d
INSERT INTO Capital_Projects
(Project_Justification)
VALUES ( '#FORM.Project_Justificati
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hi
I'm just checking in to see if you got it working or if you needed additional help.
Thanks
I'm just checking in to see if you got it working or if you needed additional help.
Thanks
ASKER
Reloaded server.
ASKER
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