Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Adding Text to RTF
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Forum LockedAdding Text to RTF

 Post Reply Post Reply
Author
cthang View Drop Down
Newbie
Newbie


Joined: 19 October 2005
Location: Canada
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote cthang Quote  Post ReplyReply Direct Link To This Post Topic: Adding Text to RTF
    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
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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'
Back to Top
cthang View Drop Down
Newbie
Newbie


Joined: 19 October 2005
Location: Canada
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote cthang Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.