Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

textarea (WYSIWYG text editor) - the html code generated won't save into my DB table.....

Status
Not open for further replies.

MDEJAKE

MIS
Sep 22, 2011
6
PH

Hi CFguys,

I have a textarea form on my page...and I made my textarea field like an Editor for my content to be able modify(font,headings,alignment etc).
But when I'm about to insert it to my DB table, insert won't continue.
i've set my table column as LongText data-type....

I made some testing and debugging and found out that the problem is the generated code produced by my text editor. IS there any possible solution on this one? I badly needed to use the Text Editor and save values into my Database.


Any help or suggestions?

Btw...I used the Tiny MCE and the ckeditor =)
 
Are you using cfquereyparam tag in your insert/update process?

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
Nope I'm not using cfqueryparam tag.


I found that the html generated code were not completely saved into my table column.
For example, the generated html code were :

Code:
<h3 style="color:blue;">
    Marriott to open first Sri Lankan property</h3>
<p>
   <br />
    <strong>After</strong> signing an agreement with Weligama Hotel Properties Ltd, the Marriott Hotels & Resorts brand plan to open their first Sri Lankan hotel.</p>


When I actual checked my table-column on the DB, only the
Code:
<h3 style=

were saved.

That's the reason when I output the value on the page, the display is blank.

Any suggestions or help?

Thanks.
 

I have used the<CFQUERYPARAM> tag on my SQL query insert statement,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.f_content3#">
but im still getting the same problem/issue.

Any help please? Thanks.
 
I ran the attached code and it saved all of the html into my database column just fine. [my database column type is memo] If my test code is what you are trying to achieve, perhaps you should share more of your code.

Code:
<cfset var.hyperText='<h3 style="color:blue;">
    Marriott to open first Sri Lankan property</h3>
<p>
   <br />
    <strong>After</strong> signing an agreement with Weligama Hotel Properties Ltd, the Marriott Hotels & Resorts brand plan to open their first Sri Lankan hotel.</p>'>
<cfquery name="putHT" datasource="#MyData#" >
	Insert Into hyperTextNote(editorData)
	Values( <cfqueryparam cfsqltype="cf_sql_longvarchar" value="#var.hyperText#" >)
</cfquery>

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 


That's good to hear for MS-Access has no problem inserting.

Im using the MySQL Database,(MyISAM engine), and datatype is LONGTEXT.

And here's the insert statement.
Code:
<cfquery datasource="#ds#" name="q_insert">
	INSERT INTO tb_article
	(d_name,d_content)
	VALUES(
          <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.f_name#">,
          <cfqueryparam cfsqltype="cf_sql_longvarchar" value="#form.f_content#">
         )
</cfquery>

Any idea on my problem/issue? Thanks.


 
I have not used MySQL, however the query worked for me using a MSSQL 2008R2 datasource...

You've not shared your code where the value of d_content is set. If your sure there is no issue there, I would suggest you ask for help on the MYSQL forum and link to this thread.

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top