Text length in FCKeditor

Posted on 2006-04-01
Last Modified: 2008-01-09
I am using FCKeditor for the first time. I have it set up but am having trouble passing the user-text into my javascript code. I understand I have to use the FCKeditorAPI, and probably need something like this:var oEditor = FCKeditorAPI.GetInstance('InstanceName') ;
but I am not clear on what the InstanceName is nor how to get the length.

Any help is greatly appreciated.
Question by:Billthehack
    LVL 6

    Assisted Solution

    When you're placing the FCKEditor on a page, you would give it an instance name. This name is what you'd pass to GetInstance. For example:

    <script type="text/javascript">
      var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
      oFCKeditor.BasePath = "/FCKeditor/"
      oFCKeditor.Create() ;

    For example, this script creates an FCKeditor with the instance name of "FCKeditor1"

    This documentation is pretty helpful with the API:
    LVL 6

    Accepted Solution

    Also,  once you call

    var oEditor = FCKeditorAPI.GetInstance('InstanceName') ;

    you could say:

    var length = oEditor.GetXHTML(true).length;

    to get the length of the HTML text...

    Author Comment

    Thanks to both of you. I use Oracle Application Express and I do not compose the code myself to create the FCKeditor item. After viewing the source code of the resulting page, I was able to identify the InstanceName and manipulate it through javascript using the length code supplied. I don't quite understand the significance of the syntax GetXHTML(true) but who cares?!


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    The first time you look at a web page and its source code, you are probably a little intimidated by the use of symbols and jargon that really looks foreign to you. You might not even know where to start to begin learning what it all means. That’…
    Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
    This video teaches users how to migrate an existing Wordpress website to a new domain.

    754 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

    22 Experts available now in Live!

    Get 1:1 Help Now