Solved

Coldfusion using TinyMCE

Posted on 2014-11-08
6
130 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 24

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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 24

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 24

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now