I have now figured out in the course of my code bumbling that I *CAN*
actually append to the file and have done so....What I need to do now
is to append to the text document the fields that have been input from
the HTML form....I will include the COMPLETE page code and please let
me know what I'm missing and how I could go about appending the text
file with fields input from the form....
Code is as follows;
(I have removed certain bits that could be considered "proprietary"
and "confidential")
*****
<%
Mode = request.form("mode")
From = request.form("from")
Ext = request.form("ext")
Subject = request.form("subject")
Body = request.form("body")
if mode = "Send" then
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "*" ' Specify a valid SMTP server
Mail.From = "*" ' Specify sender's address
Mail.FromName = "Dave Miller - Test Email" ' Specify sender's name
if subject = "" then
Mail.Subject = "Test Email"
else
Mail.Subject = subject
end if
Mail.AddAddress "dmiller"
Mail.AddReplyTo "*"
Mail.IsHTML = True
Dim mail_body
mail_body = "Name: " & request.form("name") & "<br>" &_
"Ext: " & request.form("ext") & "<br>" &_
"Body: " & request.form("body")
mail.body = mail_body & "<br>" &
request.servervariables("REMOTE_ADDR") &
request.servervariables("LOGON_USER") &
request.servervariables("REMOTE_USER")
'Mail.Body = body & vbcrlf & vbcrlf &
request.servervariables("REMOTE_ADDR")
On Error Resume Next
Mail.Send
If Err <> 0 Then
Response.Write "Error encountered: " & Err.Description
End If
End if
%>
<%
' Display a text file
dim fileobject, textfile
Set fileobject = Server.CreateObject("Scripting.FileSystemObject")
Set textfile = fileobject.OpenTextFile("D:\Inetpub\JaxWeb\jax\CS\ eucs\Text\textfile.txt",
8)
%>
<html>
<head>
<title>Comments</title>
</head>
<!-- #INCLUDE VIRTUAL="/_borders/top_nav.asp" -->
<% if mode <> "Send" then %>
<p> </p>
<p>This is a template page that will email to certain
parties and then also append to a file all information submitted
online</p>
<form method="POST" action="fileappends_2.asp"
name="fileappends" onSubmit="validate()">
<div align="left">
<table border="0" cellpadding="0" width="782">
<tr>
<td width="153">Name:</td>
<td width="619"><input type="text" name="From"
size="20"></td>
</tr>
<tr>
<td width="153">Ext.:</td>
<td width="619"><input type="text" name="Ext"
size="20"></td>
</tr>
<tr>
<td width="153">Subject:</td>
<td width="619"><input type="text" name="Subject"
size="20"></td>
</tr>
<tr>
<td width="153" valign="top">Comments:</td>
<td width="619"><textarea rows="7" name="Body"
cols="43"></textarea></td>
</tr>
<tr>
<td width="153" valign="top"> </td>
<td width="619"> </td>
</tr>
<tr>
<td width="153" valign="top"> </td>
<td width="619">
<input type="submit" value="Send Message"
name="Send"></td>
</tr>
</table>
</div>
<input type="hidden" name="mode" value="Send">
</form>
<script language="vbscript">
sub validate()
if trim(len(document.suggest.from.value)) = 0 then
msg = "Please note that you must provide your name" & vbcrlf & "if
you'd like to hear back from us for your suggestions..." & vbcrlf &
vbcrlf & "Continue to send this anonymously?"
if msgbox(msg, vbYesNo, "Please wait!") <> 1 then
window.event.returnvalue = false
document.suggest.from.focus()
exit sub
end if
end if
end sub
</script>
<% end if
if mode = "Send" and Err = 0 then
%>
<h2> </h2>
<p>The following message has been successfully submitted!</p>
<p>Name: <font color="#0000FF"> <%=from%></font><br>
Ext.: <font color="#0000FF"> <%=ext%></font><br>
Subject: <font color="#0000FF"> <%=subject%></font><br>
Comments: <font color="#0000FF"> <%=body%></font></p>
<p> </p>
<%
%>
<%
Do While textfile.AtEndOfStream = false
Response.Write(textfile.ReadLine)
Response.Write("<br>")
loop
end if
%>
</body>
</html>
<!-- #INCLUDE VIRTUAL="/_borders/bottom_nav.asp" -->
*****
END OF CODE
"Manohar Kamath [MVP]" <mk*****@TAKETHISOUTkamath.com> wrote in message news:<#Y**************@TK2MSFTNGP10.phx.gbl>...
Are you sure the line where you are getting this error is included in your
post? The two lines you have included look fine to me. Could you please
include more code, and perhaps the exact line where you are getting this
error?
--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"dmiller23462" <dm**********@yahoo.com> wrote in message
news:59**************************@posting.google.c om... Here is the code, it's not complete of course....I've been inserting
lines as I go to pinpoint the issue.....I understand that the error
message I'm getting (#185 Missing Default Property) is referring to
"textfile" but I can't find any information as to what the default
property SHOULD be....
By the way, I'm working on an online submission form for our intranet
that emails several parties AND THEN appends to a text file for later
viewing by management....I've got the email working, this is the only
"glitch" or current objective if you will....Any help would be
great....Thanks in advance...
<%
' Append to a text file
dim fileobject, textfile
Set fileobject = CreateObject("Scripting.FileSystemObject")
Set textfile =
fileobject.OpenTextFile(Server.Mappath("/jax/CS/eucs/text/textfile.txt"), 8, TRUE)
%>