FORM

  • Thread starter Thread starter dancer
  • Start date Start date
D

dancer

I have created a form in ASP.NET.
Now how do I get the results on another page (a pretty one) and email to
myself?
 
This link will not appear on my computer. I rebooted to see if I had too
many things open. Still not. Only the hour glass forever.
I entered the site by hand and received the following message:

We're sorry. The Web address you entered is not a functioning page on our
site

????
 
I have created a form in ASP.NET.
Now how do I get the results on another page (a pretty one) and email to
myself?

you can use the same "page"

<% @Import Namespace="System.Web.Mail" %>
<script language="vb" runat="server">

Sub btnSendFeedback_Click(sender as Object, e as EventArgs)

'Create an instance of the MailMessage class
Dim objMM as New MailMessage()

'Set the properties - send the email to the person who filled out
the
'feedback form.
objMM.To = "(e-mail address removed)"
objMM.From = txtEmail.Text

'If you want to CC this email to someone else, uncomment the line
below
'objMM.Cc = "(e-mail address removed)"

'If you want to BCC this email to someone else, uncomment the line
below
'objMM.Bcc = "(e-mail address removed)"

'Send the email in text format
objMM.BodyFormat = MailFormat.Text
'(to send HTML format, change MailFormat.Text to MailFormat.Html)

'Set the priority - options are High, Low, and Normal
objMM.Priority = MailPriority.Normal

'Set the subject
objMM.Subject = "4GuysFromRolla.com - Feedback"

'Set the body
objMM.Body = "At " + DateTime.Now + " feedback was sent from an
ASP.NET " & _
"Web page. Below you will find the feedback message "
& _
"send by " & txtName.Text & "." & vbCrLf & vbCrLf & _
"---------------------------------------" & vbCrLf &
vbCrLf & _
txtMessage.Text & vbCrLf


'Specify to use the default Smtp Server
SmtpMail.SmtpServer = ""

'Now, to send the message, use the Send method of the SmtpMail class
SmtpMail.Send(objMM)


panelSendEmail.Visible = false
panelMailSent.Visible = true
End Sub

</script>

<html>
<body>
<asp:panel id="panelSendEmail" runat="server">
<form runat="server">
<h2>We are interested in your feedback! Please enter the
following
requested information below to send us your comments.</h2>

<b>Your Name:</b>
<asp:textbox id="txtName" runat="server" />
<br>

<b>Your Email Address:</b>
<asp:textbox id="txtEmail" runat="server" />
<p>

<b>Your Message:</b><br>
<asp:textbox id="txtMessage" TextMode="MultiLine"
Columns="40" Rows="10" runat="server" />
<p>

<asp:button runat="server" id="btnSendFeedback" Text="Send
Feedback!"
OnClick="btnSendFeedback_Click" />
</form>
</asp:panel>


<asp:panel id="panelMailSent" runat="server" Visible="False">
An email has been sent to the email address you specified.
Thanks!
</asp:panel>
</body>
</html>

http://www.4guysfromrolla.com/webtech/080801-1.shtml
 
This code works well alone. When I enter it into the page where I want to
use it, I get this error:

Unexpected end of file looking for </form> tag.

I HAVE a </form> tag.
I am not using Visual Studio. It is simple ASP.NET coded in notepad.

Any ideas?
 
the link is correct, try again later.


dancer said:
This link will not appear on my computer. I rebooted to see if I had too many things open. Still not. Only the hour glass
forever.
I entered the site by hand and received the following message:

We're sorry. The Web address you entered is not a functioning page on our site

????
 
Here is the code: I'll be very grateful if you can find my error.

<html>
<head>
<% @Import Namespace="System.Web.Mail" %>
<script language="VB" runat="server">


Sub btnSendFeedback_Click(sender as Object, e as EventArgs)

'Create an instance of the MailMessage class
Dim objMM as New MailMessage()

'Set the properties - send the email to the person who filled out
the
'feedback form.
objMM.To = "(e-mail address removed)"

objMM.From = "(e-mail address removed)"
'send in html format
objMM.BodyFormat = MailFormat.Html
'Set the priority - options are High, Low, and Normal
objMM.Priority = MailPriority.Normal

'Set the subject
objMM.Subject = "4GuysFromRolla.com - Feedback"

'Set the body
objMM.Body = "At " + DateTime.Now + " feedback was sent from an
ASP.NET " & _
"Web page. Below you will find the feedback message " & _
"send by " & txtName.Text & "." & vbCrLf & vbCrLf & _
"---------------------------------------" & vbCrLf &vbCrLf & _
txtMessage.Text & vbCrLf

'Specify to use the default Smtp Server
SmtpMail.SmtpServer = ""
'Now, to send the message, use the Send method of the SmtpMail class
SmtpMail.Send(objMM)
panelSendEmail.Visible = false
panelMailSent.Visible = true
End Sub


</script>

</head>


<body>
<table width="750" bgcolor="#E9EDF4" table border="1"
cellpadding="3">
<h3><center><font face="Verdana">Wheeler's Accident Investigation
Form</font></h3>



<hr>
<%--____________________________________________________________________________--%> <%--ROW 1--%> <td width="250" valign="top"> <form runat="server"> <font face="Verdana" Size="2"> Location where accident occurred: <asp:textbox id="Location"runat=server Width="200"/> </td> <td align="right" valign="top" width="225"> <font face="Verdana" Size="2">Employer's Premises <asp:CheckBox id=Check1 Text="yes" runat="server" /> <asp:CheckBox id=Check2 Text="no" runat="server" /> <br> Job site <asp:CheckBox id=Check3 Text="yes" runat="server" /> <asp:CheckBox id=Check4 Text="no" runat="server" /> </td> <td> <font face="Verdana" Size="2">Date of accident</font><br> <asp:textbox id="Date" runat=server Width="100"/> </td> <%--____________________________________________________________________________--%><%--ROW 2--%> <tr> <td> <font face="Verdana" Size="2">Who was injured?</font><br> <asp:textbox id="Who" runat=server width="200"/> </td> <td align= "left"> <font face="Verdana" Size="2">Employee <asp:CheckBox id=Check5runat="server" /> <br> Non-employee <asp:CheckBox id=Check6 runat="server" /> </td> <td align="right"><font face="Verdana" Size="2"> Time of accident a.m. <asp:textbox id="am" runat=server Width="90"/> p.m. <asp:textbox id="pm" runat=server Width="90"/> </TD> <%--____________________________________________________________________________--%><%--ROW 3--%> <tr> <td> <font face="Verdana" Size="2">Date of Hire <br> <asp:textbox id="Hiredate"runat=server/> </td> <td> <font face="Verdana" Size="2">Job Title or Occupation <br><asp:textboxid="occupation" runat=server width="200"/> </td> <td> <font face="Verdana" Size="2">How long has employee worked at jobwhere injury occurred?<br><asp:textbox id="lengthofjob" runat=server/> </td> <%--____________________________________________________________________________--%><%--Row 4--%> &nbsp&nbsp <p> <asp:Label id=Label1 font-name="arial" font-size="10pt"runat="server"/><!Copied from /smirnof> <asp:panel id="panelSendEmail" runat="server"> <h2>We are interested in your feedback! Please enter the following requested information below to send us your comments.</h2> <b>Your Name:</b> <asp:textbox id="txtName" runat="server" /> <br> <b>Your Message:</b><br> <asp:textbox id="txtMessage" TextMode="MultiLine" Columns="40" Rows="10" runat="server" /> <p> <asp:button runat="server" id="btnSendFeedback" Text="SendFeedback!" OnClick="btnSendFeedback_Click" /> </form> </asp:panel> <asp:panel id="panelMailSent" runat="server" Visible="False"> An email has been sent to the email address you specified. Thanks! </asp:panel> </body></html>"Alexey Smirnov" <[email protected]> wrote in messageOn May 9, 1:43 am, "dancer" <[email protected]> wrote:>> This code works well alone.>> So, it works, and the problem is in your code>>> When I enter it into the page where I want to>> use it, I get this error:>> Unexpected end of file looking for </form> tag.>>>> A code please.>>
 
Here is the code: I'll be very grateful if you can find my error.

Hmm - I may be wrong here, but don't all webcontrols need to be inside the
<form> tag...?
 
Yep!
When I moved the </form> to AFTER the other controls, it worked. Thank
you!
Now, how can I get it to send the info from the WHOLE form on the page, and
not just some text?
 
Mark,

Not quite... you can have literal outside. In fact, I have used it in the
header to change the page title or meta tags (though I have started a thread
related to literal tags.). There may be other controls as well that you can
have outside your form tag. (Obviously, buttons, form fields etc have to be
inside)

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 
Yep!
When I moved the </form> to AFTER the other controls, it worked. Thank
you!
Now, how can I get it to send the info from the WHOLE form on the page, and
not just some text?






- Show quoted text -

As in the given example you have to reference the controls on the ASPX
page

Date.Text gives a text of the Date control (Date of accident)
CheckBox1.Checked gives true of false of the CheckBox1 (Employer's
Premises)
etc.
 
OK, I did that. (Referenced the controls to get the other answers to the
form to appear.)
Now, how do I get the email to be formatted in the same fashion as the form
that the user fills out?
Thank you.
 
Back
Top