Hi,
I'm looking to add some text/html to a rad editor on page load.
The Rad Editor is being used on a NewForm.aspx page as a replacement for the default rich text editor. As the control is being added dynamically, i can't obtain a reference using the control name:
So my approach is to traverse over the DOM and find the ID of the RAD editor control. I can do this successfully using the below javascript:
Using the $find function on Firefox returns a reference to the Rad editor instance. However I get nothing back when doing this from IE.
Can you help? Is there an easier way to set text in the rad editor for a specific page?
I'm looking to add some text/html to a rad editor on page load.
The Rad Editor is being used on a NewForm.aspx page as a replacement for the default rich text editor. As the control is being added dynamically, i can't obtain a reference using the control name:
var editor = $find("<%=RadEditor1.ClientID%>"); |
So my approach is to traverse over the DOM and find the ID of the RAD editor control. I can do this successfully using the below javascript:
<script type="text/javascript"> |
_spBodyOnLoadFunctionNames.push("fillDefaultValues"); |
function fillDefaultValues() { |
var oJobBrief = getTagFromIdentifierAndTitle("textarea", "TextField", "Job Brief"); |
var temp1 = oJobBrief.parentNode.previousSibling; |
var oRadEditor = $find(temp1.id); |
oRadEditor._contentArea.innerHTML = "test"; |
} |
function getTagFromIdentifierAndTitle(tagName, identifier, title) { |
var len = identifier.length; |
var tags = document.getElementsByTagName(tagName); |
for (var i=0; i < tags.length; i++) { |
var tempString = tags[i].id; |
if (tags[i].title == title && (identifier == "" || tempString.indexOf(identifier) == tempString.length - len)) { |
return tags[i]; |
} |
} |
return null; |
} |
</script> |
Using the $find function on Firefox returns a reference to the Rad editor instance. However I get nothing back when doing this from IE.
Can you help? Is there an easier way to set text in the rad editor for a specific page?