Web Wiz
Home
Home
Hosting Services
Hosting Services
Knowledgebase
Knowledgebase
Community
Community
Customer Login
Customer Login

Web Wiz Forums Homepage

  New Posts New Posts RSS Feed - Including WW RTE from inside script
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Including WW RTE from inside script

 Post Reply Post Reply Page  12>
Author
hakonf View Drop Down
Newbie
Newbie


Joined: 18 October 2009
Status: Offline
Posts: 5
Points: 6
Post Options Post Options   Quote hakonf Quote  Post ReplyReply Direct Link To This Post Topic: Including WW RTE from inside script
    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?

Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Poole, England
Status: Offline
Posts: 23178
Points: 6378
Post Options Post Options   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 19 October 2009 at 12:28pm
You could try Server.Execute("RTE_editor_inc.asp") and see if that works instead.
Back to Top
hakonf View Drop Down
Newbie
Newbie


Joined: 18 October 2009
Status: Offline
Posts: 5
Points: 6
Post Options Post Options   Quote hakonf Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Poole, England
Status: Offline
Posts: 23178
Points: 6378
Post Options Post Options   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
hakonf View Drop Down
Newbie
Newbie


Joined: 18 October 2009
Status: Offline
Posts: 5
Points: 6
Post Options Post Options   Quote hakonf Quote  Post ReplyReply Direct Link To This Post 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>
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Poole, England
Status: Offline
Posts: 23178
Points: 6378
Post Options Post Options   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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">
Back to Top
hakonf View Drop Down
Newbie
Newbie


Joined: 18 October 2009
Status: Offline
Posts: 5
Points: 6
Post Options Post Options   Quote hakonf Quote  Post ReplyReply Direct Link To This Post 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>
 
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Poole, England
Status: Offline
Posts: 23178
Points: 6378
Post Options Post Options   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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>
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down


© Copyright 2001-2010 Web Wiz®. All rights reserved.
All prices are shown excluding VAT, which is charged where applicable. $, € prices shown as a guideline only.