Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Loading Templates from a form
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Loading Templates from a form

 Post Reply Post Reply
Author
Brolin99 View Drop Down
Groupie
Groupie
Avatar

Joined: 03 May 2003
Location: New Zealand
Status: Offline
Points: 58
Post Options Post Options   Thanks (0) Thanks(0)   Quote Brolin99 Quote  Post ReplyReply Direct Link To This Post Topic: Loading Templates from a form
    Posted: 27 June 2004 at 7:46am

Hey all,

I have a few forms on a page, and am attempting to load either a saved message, or a static template into an editable Iframe. But it just loads the default template (template1.asp) no matter what I do!

Please help me!!!

The code to load the template is:

<% If Request.Action = "load_message" Then %>
<script language="javascript">
//Create an iframe and turn on the design mode for it
document.write ('<iframe id="fld_message" src="<%=strloadmessage%>" width="100%" height="400"></iframe>')
frames.fld_message.document.designMode = "On";
</script>
<!-- Display a message for IE users with JavaScript turned off -->
<div align="center"><noscript><br>
<br>
JavaScript must be enabled on your web browser for you to use the mail editor!</noscript></div>
<% ElseIf Request.action = "load_template" Then %>
<script language="javascript">
//Create an iframe and turn on the design mode for it
document.write ('<iframe id="fld_message" src="<%=strtemplate%>" width="100%" height="400"></iframe>')
frames.fld_message.document.designMode = "On";
</script>
<!-- Display a message for IE users with JavaScript turned off -->
<div align="center"><noscript><br>
<br>
JavaScript must be enabled on your web browser for you to use the mail editor!</noscript></div>
<% Else %>
<script language="javascript">
//Create an iframe and turn on the design mode for it
document.write ('<iframe id="fld_message" src="templates/template1.asp" width="100%" height="400"></iframe>')
frames.fld_message.document.designMode = "On";
</script>
<!-- Display a message for IE users with JavaScript turned off -->
<div align="center"><noscript><br>
<br>
JavaScript must be enabled on your web browser for you to use the mail editor!</noscript></div>      
<% End If %>

The various forms involved are:

FORM:
<form name="load_message" method="POST" action="sendemail.asp">
<select size="1" name="fld_load_message" style="width: 200">
<option value="no">- - - - - - - -</option><%=getsavedmessages()%></select>
<input type="submit" value="Load" name="submit">
<input type="hidden" name="action" value="load_message">
</form>
VB CODE:
If Request("action") = "load_message" Then
Set rs = conn.execute("Select * From  " & tbl_prefix & "saved_messages Where save_name = '" & Request("fld_load_message") & "'", adOpenForwardOnly, adLockReadOnly)

strloadmessage = rs("message")
strloadsubject = rs("subject")
rs.Close
Set rs = nothing
End If

FORM:
<form name="template" method="POST" action="sendemail.asp">
<select size="1" name="select" style="width: 200">
<option value="no">- - - - - - - -</option>
<option value="Template1">WBE Newsletter</option>
<option value="Template2">WBE Plain</option>
<option value="Template3">WBE Pricelist</option>
</select>
<input type="hidden" name="action" value="load_template">
<input type="submit" value="Load Template" name="submit">
</form>

VB CODE:
If Request.Form("template") = "Template1" Then
strtemplate = "templates/template1.asp"
ElseIf Request.Form("template") = "Template2" Then
strtemplate = "templates/template2.asp"
ElseIf Request.Form("template") = "Template3" Then
strtemplate = "templates/template3.asp"
End If

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.