Change html value with JavaScript.

4 posts, 0 answers
  1. Ian
    Ian avatar
    29 posts
    Member since:
    Jun 2009

    Posted 10 Feb 2011 Link to this post

    I'm using the MOSS editor for SharePoint v5.7. I can't seem to get at the client object at all. I've tried using:
     var editorInstance = $find("<%= this.myEditorField.ClientID %>");
    but this just returns null. This method works with the standard Telerik editor but not the one for MOSS. Please advise on the correct way to do this.

    Thanks.
  2. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 11 Feb 2011 Link to this post

    Hello Ian,

    In order to help you further I will need some additional information.

    1. In what scenario are you using the control. Is it WCM, Web Part, or a list (list, wiki, blog etc.).
    2. Could you send me the code of the page? It will be easier for me if I see the whole picture.
    3. Could you describe the functionality which you are trying to achieve. There might be a different approach to get it working.


    Kind regards,
    Stanimir
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  3. Ian
    Ian avatar
    29 posts
    Member since:
    Jun 2009

    Posted 11 Feb 2011 Link to this post

    I'm using it in a WCM context, code below, thanks.

    <%@ Register TagPrefix="telerikRFE" Assembly="RadEditorSharePoint, Version=5.6.0.0, Culture=neutral, PublicKeyToken=1f131a624888eeed" Namespace="Telerik.SharePoint.FieldEditor" %>
    <telerikRFE:RadHtmlField id="myEditorField" FieldName="MySPField" runat="server" />
    <input type="button" onclick="checkHtml();" />

    <script type="text/javascript">
    function checkHtml()
    {
        var editorInstance = $find("<%= this.myEditorField.ClientID %>"); 
         alert ( editorInstance.get_html() );  // editorInstance is null here!
    }
    </script>
  4. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 15 Feb 2011 Link to this post

    Hi Ian,

    You can not get the instance of RadEditor by the following code:
    var editorInstance = $find("<%= this.myEditorField.ClientID %>");
    What you should know is that myEditorField is an instance of RadHtmlField and nod RadEditor or MOSSRadEditor. What I suggest you to do is using the OnClientSubmit event to modify the content. Review the following online help articles:
    1. OnClientSubmit.
    2. Set Properties Via Config File

    In addition a good place for the custom javascript code is the MOSSEditorTools.js, which is located in the /Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/ folder.


    All the best,
    Stanimir
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
Back to Top