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