Print Page | Close Window

Adding Text to RTF

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Rich Text Editor (RTE)
Forum Description: Support forum for the Web Wiz Rich Text Editor (RTE).
URL: https://forums.webwiz.net/forum_posts.asp?TID=16955
Printed Date: 29 March 2026 at 7:41am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Adding Text to RTF
Posted By: cthang
Subject: Adding Text to RTF
Date Posted: 19 October 2005 at 1:56pm
Hi,
 
I am trying to add text from the db into the RTF text box and cannot get it to work. It doesn't give an error. Here is my code that inserts the text into the RTF text box.
 
This is the script:
 
<SCRIPT LANGUAGE="JavaScript">
oldvalue = "";
function passText(passedvalue) {
  if (passedvalue != "") {
    var totalvalue = document.form1.comment_term1.value+""+passedvalue+" ";
    document.form1.comment_term1.value = totalvalue;
    oldvalue = document.form1.comment_term1.value;
  }
}
</script>
 
 
This should submit into the RTC textbox:
 
<input type=button value="Add COmment" onClick="passText(this.form.dropdownbox.options[this.form.dropdownbox.selectedIndex].value);" name="button" class="button1">
 
Any suggestion would be great.
 
Thanks



Replies:
Posted By: WebWiz-Bruce
Date Posted: 20 October 2005 at 6:48am
The RTE lays over the top of your orginal textarea and when it loads the data in your textarea is passed to the RTE's textarea (the RTE's textarea is actually an iframe layed over your textrea).

This means that the data in your textarea needs to be in there when the page is loaded, by the look of your function it is not doing this till after the page is loaded.

You could try either using ASP to place the code into the textarea when the page is loaded, or passing the data directly to the RTE's Iframe which is called 'WebWizRTE'


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: cthang
Date Posted: 20 October 2005 at 11:10pm
Thanks for the fast reply. I haven't used iframe before and don't know how i would pass the data directly to th RTE's iframe.
 
Would you be able to give me an example on how to do this.
 
 
Thanks again


Posted By: WebWiz-Bruce
Date Posted: 21 October 2005 at 9:53am
You would put the source in as the name of the Iframe, hust like when you pass data from one page to another using javascript.

document.getElementById('WebWizRTE').contentWindow.document


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net