Print Page | Close Window

Including WW RTE from inside script

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=27950
Printed Date: 28 March 2026 at 6:03am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Including WW RTE from inside script
Posted By: hakonf
Subject: Including WW RTE from inside script
Date Posted: 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?




Replies:
Posted By: WebWiz-Bruce
Date Posted: 19 October 2009 at 12:28pm
You could try Server.Execute("RTE_editor_inc.asp") and see if that works instead.

-------------
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: hakonf
Date 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.


Posted By: WebWiz-Bruce
Date Posted: 19 October 2009 at 1:11pm
You can use include files with a script block eg:-

<% If myVar = "xxx" Then 
    %><!--#include file="RTE_editor_inc.asp" --><%
End If
%>

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.


-------------
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: hakonf
Date 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>


Posted By: WebWiz-Bruce
Date 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">


-------------
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: hakonf
Date 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>
 


Posted By: WebWiz-Bruce
Date 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>

-------------
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: hakonf
Date Posted: 20 October 2009 at 3:42pm
Shorthands appreciated; I may be confusing the issue. The position where I want to #include is in the middle of a Subroutine which is defined in a file, let us call the file i.asp. Th file i.asp has a structure like this:
 
<script runat=Server>
Sub xxx
...
</script>
<-- #include file=... -->
<script>
...
End Sub
Sub xyz
...
End Sub
</script>
 
If I insert the two tags in red, I cannot create the necessary connection between the upper and lower parts of the code, except perhaps by splitting the Sub in two and arranging for some sort of transfer of parameters between them.


Posted By: WebWiz-Bruce
Date Posted: 20 October 2009 at 3:54pm
All I can say is to try rewriting your code not to use the sub and use some other method instead.

-------------
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: kimboy
Date Posted: 15 July 2011 at 10:16am
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.



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