fckeditor and AJAX

fckeditor is cool, and so is AJAX. I've never used them together until today, and it's quite simple.

One gotcha that was killing me - if/when you use Javascript to send the contents of the fckeditor window, keep these few things in mind (for use with ColdFusion, BTW):

  • Assuming you have a submit button that sends the contents to a JS function, use this to grab that content:
    FCKeditorAPI.GetInstance('myInstance').GetXHTML());
  • And if/when you send your data from JS to CF, be sure to use the javascript encode function:
    var foo = encode(FCKeditorAPI.GetInstance('myInstance').GetXHTML()));
  • And if/when you use CF to work with that data, decode it with urldecode:
    <cfset fixedContent = urldecode(incomingData)>

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)

Psykel blog uses BlogCFC (by Raymond Camden). Layout design inspired by arcsin