Disable Radeditor using javascript on client side

4 posts, 0 answers
  1. Creztor
    Creztor avatar
    1 posts
    Member since:
    Jun 2010

    Posted 27 Jun 2010 Link to this post

    Not sure if this is the correct forum or if this can be done, but is there anyway the radeditor can be disabled using javascript on the client side?  I am having problems with a website I visit that uses a radeditor and wondering if I can disable it using a javascript command?  I know of other editors (such as tinyMCE) and curious if I can do the same for Radeditor if a site is having problems?  Obviously I am not a programmer but appreciate any info if this can or can't be done.

  2. Rumen
    Admin
    Rumen avatar
    12601 posts
    Member since:
    Dec 2014

    Posted 30 Jun 2010 Link to this post

    Hello Creztor,

    You can disable RadEditor on the client using the using the editor.enableEditing(false) method. Here is an example:

    <telerik:RadEditor runat="server" ID="RadEditor1">
        <Content>some test content</Content>
    </telerik:RadEditor>
    <input type="button" onclick="toggleEditing();return false;" value="Toggle editing" />
    <script type="text/javascript">
    var toggle = true;
    function toggleEditing()
    {
        var editor = $find("<%=RadEditor1.ClientID%>");
        toggle = !toggle;
        editor.enableEditing(toggle);
        editor.set_editable(toggle);
        if (toggle == false) editor.get_document().body.style.backgroundColor = "gray";
        else editor.get_document().body.style.backgroundColor = "";
    }
    </script>

    This method will disable the content area typing and the toolbar, but the editor will be rendered on the page and its client-side API will be fully functional.

    You can also disable RadEditor from the server by setting the Enabled property of the editor to false. When the Enabled property is set to false, RadEditor is rendered as a simple DIV element on the page, containing the value of its Html property. The RadEditor object is missing and it is not possible to use the RadEditor's Client-Side API, its client event handlers and methods.

    Best regards,
    Rumen
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

  3. Mohammad Bazlamit
    Mohammad Bazlamit avatar
    2 posts
    Member since:
    May 2010

    Posted 21 Sep 2010 Link to this post

    Thanks Rumen  for the help,

     I tried your solution but I had a problem which is after disabling and enabling the radeditor for 2 or 3 times, the control goes disabled even I call the following 

    editor.enableEditing(true);
    editor.set_editable(true);

    Any Idea to solve this problem 

    I'm using version 2010.1.309.35 

    Thank you in advance,
    M. Bazlamit

  4. Mohammad Bazlamit
    Mohammad Bazlamit avatar
    2 posts
    Member since:
    May 2010

    Posted 21 Sep 2010 Link to this post

    Hi again,

    I solved the problem, the problem was I calling twice the following
    editor.enableEditing(false);

    which was cause the problem.

    Best regards,
    M Bazlamit.

Back to Top