![]() |
Including WW RTE from inside script |
Post Reply
|
Page 12> |
| Author | |
hakonf
Newbie
Joined: 18 October 2009 Status: Offline Posts: 5 Points: 6 |
Post Options
Quote Reply
Topic: Including WW RTE from inside scriptPosted: 18 October 2009 at 12:06pm |
|
I would like to use the WW RTE for a textarea that is generated from inside a server-side VB script. However, #include file is not allowed inside a script. If I #include RTE_editor_inc.asp outside the script, the menu is placed in the wrong position and it does not seem to work. Any suggestions - apart from refraining from using such scripts to generate forms? |
|
![]() |
|
WebWiz-Bruce
Admin Group
Web Wiz Developer Joined: 03 September 2001 Location: Poole, England Status: Offline Posts: 22683 Points: 5874 |
Post Options
Quote Reply
Posted: 19 October 2009 at 12:28pm |
|
You could try Server.Execute("RTE_editor_inc.asp") and see if that works instead.
|
|
![]() |
|
hakonf
Newbie
Joined: 18 October 2009 Status: Offline Posts: 5 Points: 6 |
Post Options
Quote Reply
Posted: 19 October 2009 at 12:51pm |
|
Thanks very much indeed, that was very useful. This command puts the menu in the right position, without error messages.
The effect is limited: Some buttons open dialog boxes, but drop-down lists do not drop down, and I cannot achieve any formatting effects in the textarea box. Furthermore, the format of the tools is a bit off: buttons are taller that the toolbar on which they reside; hence four rows of buttons need five bars. If there are obvious reasons for this I would be glad to learn about them; if not, I will engage in some more debugging before returning to the group for some more advice. Edited by hakonf - 19 October 2009 at 1:02pm |
|
![]() |
|
WebWiz-Bruce
Admin Group
Web Wiz Developer Joined: 03 September 2001 Location: Poole, England Status: Offline Posts: 22683 Points: 5874 |
Post Options
Quote Reply
Posted: 19 October 2009 at 1:11pm |
|
You can use include files with a script block eg:-
Although technically the include file is still outside of the script block the ASP code still decides if the include file is included or not. |
|
![]() |
|
hakonf
Newbie
Joined: 18 October 2009 Status: Offline Posts: 5 Points: 6 |
Post Options
Quote Reply
Posted: 19 October 2009 at 4:35pm |
|
<html>
<head></head> <body onLoad="initialiseWebWizRTE();"> <form action="t.asp" method="post" name="myForm" id="myForm"> <% strFormName = "myForm"
strTextAreaName = "myTextarea" Server.Execute("RTE_editor_inc.asp") ' This works to load the toolbars but not to activate the formatting tools
' It works OK with #include but #include cannot be inside a <script></script> block %> <textarea cols="90" rows="33" name="myTextarea" id="myTextarea"> Pre-filled textarea contents goes here </textarea><br> <input type="submit" name="Submit" id="Submit" value="Submit Form" /> <input type="reset" name="reset" id="reset" value="Reset Form" /> </form> </body> </html> |
|
![]() |
|
WebWiz-Bruce
Admin Group
Web Wiz Developer Joined: 03 September 2001 Location: Poole, England Status: Offline Posts: 22683 Points: 5874 |
Post Options
Quote Reply
Posted: 19 October 2009 at 5:10pm |
|
Includes can be used inside script blocks as I have shown in the previous post, but instead of using the usual include code place it between and closing and opening script bloc:-
<form action="t.asp" method="post" name="myForm" id="myForm"> <% strFormName = "myForm" strTextAreaName = "myTextarea" %><!--#include file="RTE_editor_inc.asp" --><% 'This allows you to use ASP to decide if an include is used or not within a page %> <textarea cols="90" rows="33" name="myTextarea" id="myTextarea"> |
|
![]() |
|
hakonf
Newbie
Joined: 18 October 2009 Status: Offline Posts: 5 Points: 6 |
Post Options
Quote Reply
Posted: 19 October 2009 at 5:21pm |
|
Yes; it works to put it between these tags:
<% ... %> <!--#include ... > <% ... %>
but in my case, my subroutines are in a file that begins/ends with <script> ... </script> tags, and in this case I can't make it work with:
<script> ... </script> <!--#include ...> <script> ... </script>
nor with:
<script> ... %> <!--#include ...> <% ... </script>
|
|
![]() |
|
WebWiz-Bruce
Admin Group
Web Wiz Developer Joined: 03 September 2001 Location: Poole, England Status: Offline Posts: 22683 Points: 5874 |
Post Options
Quote Reply
Posted: 20 October 2009 at 10:42am |
|
Replace <script> and </script> with <% and %> or vise versa as they both mean the same thing. <% and %> is shorthand for <script> and </script>
|
|
![]() |
|
Post Reply
|
Page 12> |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |