This is a migrated thread and some comments may be shown as answers.

Change html value with JavaScript.

3 Answers 43 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 1
Ian asked on 11 Feb 2011, 01:12 AM
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.

3 Answers, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 11 Feb 2011, 08:32 AM
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.
0
Ian
Top achievements
Rank 1
answered on 11 Feb 2011, 09:02 AM
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>
0
Stanimir
Telerik team
answered on 15 Feb 2011, 08:38 AM
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 >>
Tags
WebParts for SharePoint
Asked by
Ian
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Ian
Top achievements
Rank 1
Share this question
or