Print Page | Close Window

Loading Templates from a form

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=11008
Printed Date: 28 March 2026 at 6:03am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Loading Templates from a form
Posted By: Brolin99
Subject: Loading Templates from a form
Date 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




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