Link to home
Create AccountLog in
Avatar of cyberfyb

asked on

How to transmit text in a FCKEditor' CFTEXTAREA in ColdFusion 8?

Based on the logic of copying content into a normal textarea, how to do the same with the FCKEditor's with skin at Office2003 (I mention it in case it has a difference between Standard, Silver or Office2003).

I tried a method found (the only) with a search in GOOGLE:

ColdFusion.RichText.setValue('fDescription', '<p>Test</p>);

But this not work! I've got a runtime error in JavaScript is I use the normal document.getElementById('fDescription').innerHTML = '<p>Test</p>'; and I understand very well that the FCKEditor is much more than a simple TEXTAREA.

I checked on the support site of et they are refering to another method but something that it is outside the scope of ColdFusion 8. In fact, it is already included in the library when using through Coldfusion 8 so it must be a way to use it in a more direct way. This must be just a little word to know in order to make it works.

Thank you for any hint on this issue!
Avatar of Zvonko
Flag of North Macedonia image

Check this:
<cfform format="html" name="myform" >
<cftextarea richtext="true" name="fDescription" > 
<p><strong>my</strong>&nbsp;<font color="#ff0000">Test</font></p>

Open in new window

Avatar of cyberfyb


I do not understand the point of your solution! Where is you javascript to populate the value of the CFTEXTAREA?
Where is the value for the CFTEXTAREA comming from?
Let's say it is coming from the database and you can imagine a button with a click event where the user will decide if he/she wants or not copy the information into the CFTEXTAREA in a richmode. than the problem start because the standard method of JavaScript to copy using the innerHTML cannot be use with the FCKEditor component.
Database is on CF side. So where do you store the db value to be present on browser side? In a hidden form field or elsewhere?

the page is loaded and while the page as been prepare to be displayed, the CF have a query to keep the information about (for an example) the customer. Than, JavaScript can be use to instantiate some dynamic features from the client-side before the next SUBMIT. You can easilly use - on any where - the value returns by the query just by using <cfoutput>#theVariableName#</cfoutput> into some JavaScript code but always have to consider the fact that the information has been updated at the load of the page and that query will not change until the next SUBMIT.

Anyway, in this case specifically when using the component from FCKeditor combine with ColdFusion 8, you need to use the following JavaScript method in order to transmit conent dynamically (from JS perspective) into the CFTEXTAREA:

      function getSameDescription(fieldName, fieldValue)
            //ColdFusion.RichText.setHTML(fieldName, fieldValue);
            document.getElementById('fDescription').InsertHtml = fieldValue;
Avatar of Zvonko
Flag of North Macedonia image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Thank you to have updated my code! You made this exchange problem more accurate to read and because of that, I put this in the knowledge base.
Please explain why you graded my solution with the grad B.
"You made this exchange problem more accurate to read " You had NO solution before my solution. More accurate to read your NONSENSE proposal! And for you I waste my time and you not even answer to my question. Next time think more ACCURATE how you grade my solutions ;-)