Solved

Coldfusion using TinyMCE

Posted on 2014-11-08
6
142 Views
Last Modified: 2014-11-10
I am developing a lightweight editor using TinyMCE.

Once the user has entered the text and images in in TinyMCE, I capture that information using #form.post# and store it in a table.

The #form.post# contains HTML tags such as
<p>Hello&nbsp;</p> <p>My name is John</p> <p><span style="text-decoration: underline;"><em>I like Coldfusion/em></span></p>

My question is, how do I open TinyMCE and pass the stored table information (#form.post#) back to TinyMCE?
0
Comment
Question by:Errol Farro
  • 3
  • 2
6 Comments
 
LVL 28

Accepted Solution

by:
Pravin Asar earned 500 total points
ID: 40431248
<textarea id="elm1" name="contents" rows="30" cols="80" style="width:600px; height: 400px;"><cfoutput>#htmlcodeformat(qryDATA.contents)#</cfoutput>      </textarea>

See attached file for complete implementation example.

Once you figure out the tinyMCE editor options, it is really easy to customize the UI.
tinyMCE.html
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 40431333
Hello
I would disagree with the htmlcodeformat answer!

You should use
#htmlEDITformat(trim(xxx))#
xxx is simply your variable name of course - it's your form.post from your example

good luck ...
0
 
LVL 28

Expert Comment

by:Pravin Asar
ID: 40431371
of course you need wrap with cfoutput

cfoutput>#htmlcodeformat(qryDATA.contents)#</cfoutput>

I have posted complete example, which shows how to
1. Customize tinyMCE
2. Populate tinyMCE textarea
3. Read textarea and update/add record

Hope this example helps to understand complete lifecycle.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 25

Expert Comment

by:dgrafx
ID: 40431405
It's not a matter of wrapping in cfoutput - it's a matter of using htmlEDITformat instead of htmlcodeformat !

just fyi ...
0
 
LVL 52

Expert Comment

by:_agx_
ID: 40433164
With all due respect, the correct answer is HTMLEditFormat as dgrafx suggested.

Though the functions may seem similar, they serve different purposes. HTMLCodeFormat is designed to display code. Like when you use the "Code" button on the EE toolbar. It encloses the content in PRE tags, so you see it as literal HTML code like this:

      My name is <strong>John</strong>

Open in new window


HTMLEditFormat is designed for rendering html code, which is what rich text editor does. So instead of html code, you would see:

      My name is John

So the correct function is HTMLEditFormat  - not HTMLCodeFormat
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 40433392
Yes - what _agx_ said is 100% accurate.
Check out his credentials if you doubt his opinion. He is the expert that we experts rely on when we don't know or are having trouble with a difficult issue.

htmlcodeformat may appear to work at first glance, but upon closer inspection you'll see that it does not.

When I saw that the incorrect answer had been chosen by the question asker I was expecting that Pravin Asar (who posted the accepted incorrect answer) would have by then realized his error and spoken up.
The main purpose of Experts-Exchange is to provide accurate information - not to just receive points - especially for incorrect answers.

And I mean no disrespect to anyone - I just needed to post for the above reason.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question