|
| |
| Author |
Message |
faysal_fuuast
Joined: 30 Dec 2006 Posts: 15 Location: USA
|
Posted: Tue Jan 16, 2007 10:13 pm Post subject: Validation controls in ASP.NET |
|
|
Please see the following site for validation controls in .net technologies.
w3schools.com
|
|
| Back to top |
|
 |
jacobfernandas
Joined: 08 Jul 2009 Posts: 1
|
Posted: Thu Jul 09, 2009 7:24 am Post subject: |
|
|
Hey Guys,
Any and all help would be greatly appreciated.
Here is a simple ASP script that collects information and sends an e-mail. There is only one problem. People can just submit a blank one. I have searched around the internet and cannot find any helpful tutorials on this. What I am needing to do is juat make it so that something must be entered in each field. Not anything complex at all, just so that it cannot be blank. One again, any and help would be appreciated. Here is the code:
<%
Dim UsableDate
UsableDate = WeekDayName(WeekDay(Date), true) & ", " & Day(Date) & " " & MonthName(Month(Date), true) & " " & Year(Date) & " " & FormatDateTime(DateAdd("h", 2, now), 4) & " (CST)"
Name = Request.Form("name")
UserEmail = Request.Form("email")
Company = Request.Form("Company")
Street = Request.Form("Street")
Street2 = Request.Form("Street2")
City = Request.Form("City")
State = Request.Form("State")
Zip = Request.Form("Zip")
Phone = Request.Form("phone")
Fax = Request.Form("fax")
Comments = Request.Form("comments")
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.RemoteHost = "mail.fakewebsite.com"
Mailer.AddRecipient "Sales", "mthomas@fakewebsite.com"
Mailer.FromName = "Online Brochure Request"
Mailer.FromAddress = "do_not_reply@fakewebsite.com"
Mailer.Subject = "Brochure Request"
Mailer.DateTime = UsableDate
If IsEmpty(UserEmail) or IsNull(UserEmail) or UserEmail="" then
Else
Mailer.ReplyTo = UserEmail
End If
Mailer.BodyText = "Date: " & UsableDate &_
VbCrLf &_
VbCrLf & "Name: " & Name &_
VbCrLf & "Company: " & Company &_
VbCrLf & "Email: " & Useremail &_
VbCrLf & "Phone: " & Phone &_
VbCrLf & "Fax: " & Fax &_
VbCrLf & "Street: " & Street &_
VbCrLf & "Street: " & Street2 &_
VbCrLf & "City: " & City &_
VbCrLf & "State: " & State &_
VbCrLf & "Zip: " & Zip &_
VbCrLf & "Comments: " & Comments &_
VbCrLf
'sends mail...required
if Mailer.SendMail then
Response.Redirect "http://www.?.com/confirmation.html"
else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if
%>
Thanks,
|
|
| Back to top |
|
 |
davidbeckam
Joined: 08 Jul 2009 Posts: 1
|
Posted: Fri Jul 10, 2009 8:14 am Post subject: |
|
|
Hey Guys,
Any and all help would be greatly appreciated.
Here is a simple ASP script that collects information and sends an e-mail. There is only one problem. People can just submit a blank one. I have searched around the internet and cannot find any helpful tutorials on this. What I am needing to do is juat make it so that something must be entered in each field. Not anything complex at all, just so that it cannot be blank. One again, any and help would be appreciated. Here is the code:
<%
Dim UsableDate
UsableDate = WeekDayName(WeekDay(Date), true) & ", " & Day(Date) & " " & MonthName(Month(Date), true) & " " & Year(Date) & " " & FormatDateTime(DateAdd("h", 2, now), 4) & " (CST)"
Name = Request.Form("name")
UserEmail = Request.Form("email")
Company = Request.Form("Company")
Street = Request.Form("Street")
Street2 = Request.Form("Street2")
City = Request.Form("City")
State = Request.Form("State")
Zip = Request.Form("Zip")
Phone = Request.Form("phone")
Fax = Request.Form("fax")
Comments = Request.Form("comments")
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.RemoteHost = "mail.fakewebsite.com"
Mailer.AddRecipient "Sales", "mthomas@fakewebsite.com"
Mailer.FromName = "Online Brochure Request"
Mailer.FromAddress = "do_not_reply@fakewebsite.com"
Mailer.Subject = "Brochure Request"
Mailer.DateTime = UsableDate
If IsEmpty(UserEmail) or IsNull(UserEmail) or UserEmail="" then
Else
Mailer.ReplyTo = UserEmail
End If
Mailer.BodyText = "Date: " & UsableDate &_
VbCrLf &_
VbCrLf & "Name: " & Name &_
VbCrLf & "Company: " & Company &_
VbCrLf & "Email: " & Useremail &_
VbCrLf & "Phone: " & Phone &_
VbCrLf & "Fax: " & Fax &_
VbCrLf & "Street: " & Street &_
VbCrLf & "Street: " & Street2 &_
VbCrLf & "City: " & City &_
VbCrLf & "State: " & State &_
VbCrLf & "Zip: " & Zip &_
VbCrLf & "Comments: " & Comments &_
VbCrLf
'sends mail...required
if Mailer.SendMail then
Response.Redirect "http://www.?.com/confirmation.html"
else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if
%>
Thanks |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|