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

[Solved] Getting RadEditor Content from Javascript

2 Answers 365 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Ole Albers
Top achievements
Rank 2
Ole Albers asked on 02 Jun 2009, 02:04 PM
Hi there.
I use some methods to automaticly save the windows content while closing. One of the tasks I do there is sending the content of my TextBoxes to hidden fields within my parent form:

 function OnClosePostBack() { 
                // Automatisches Speichern der Email beim Schließen (Entwurf)                 
               var parent_recipients = window.parent.theForm.ctl00$ContentPlaceHolderBody$Email_Recipients;                 
               var parent_subject=window.parent.theForm.ctl00$ContentPlaceHolderBody$Email_Subject; 
               var parent_body=window.parent.theForm.ctl00$ContentPlaceHolderBody$Email_Body; 
               var parent_id=window.parent.theForm.ctl00$ContentPlaceHolderBody$Email_Id; 
                
               var thisSubject = document.getElementById("txtMailSubject"); 
               var thisMailId = document.getElementById("JSmailId"); 
               var thisRecipients = document.getElementById("txtMailTo"); 
               var thisBody = document.getElementById("EditorMailBody2"); 
                
               parent_recipients.value=thisRecipients.value; 
               parent_subject.value=thisSubject.value; 
               parent_body.value=thisBody.Content; 
               parent_id.value=thisMailId.value; 
            } 

This works fine with txtMailSubject, JSmailId and txtMailTo which are all Textboxes. But I cannot reach the content of the "EditorMailBody2" which is a radeditor. The .Text property is undefined, also is the .Content-Property.
The .innerHtml-Property is filled but does not contain what I need. I'm searching for the "simple" Text-content of that editor.

Any hints?

2 Answers, 1 is accepted

Sort by
0
Accepted
Svetlina Anati
Telerik team
answered on 03 Jun 2009, 02:12 PM
Hello Ole,

I examined your code and I noticed that you are referencing th editor by using the getElementById method - note, that this reference an HTML element and in order to use a control's client object to use its API you should use the method $find. You can find more details about referencing the RadEditor's client object below:

http://www.telerik.com/help/aspnet-ajax/editor_getingreferencetoradeditor.html

Once you correctly reference the client object you are able to use its client methods - please decide what is the exact one you need (get only plai text, get the whole html, etc) and use it:

http://www.telerik.com/help/aspnet-ajax/editor-getting-familiar-with-client-side-api.html


All the best,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ole Albers
Top achievements
Rank 2
answered on 03 Jun 2009, 02:34 PM
works like a charm. Thanks again.
Tags
Editor
Asked by
Ole Albers
Top achievements
Rank 2
Answers by
Svetlina Anati
Telerik team
Ole Albers
Top achievements
Rank 2
Share this question
or