This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Dreamweaver > July 2005 > Validate form in ASP
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Validate form in ASP
|
|
| OlDirty 2005-07-05, 7:26 pm |
| Hey everyone,
I have recently discovered that some users cannot see javascript.The form
currently uses the Yaromat Check Form behavior in DWMX.
I have been told I need to validate the form in the asp code. I am not at all
an expert in asp so any help would be great. Thanks.
Here's the code...
<%@ Language=VBScript %>
<%
strBody1 = "First Name: " & Request.Form("firstname") & vbNewLine & "Last
Name: " & Request.Form("lastname") & vbNewLine & "Mailing Address: " &
Request.Form("address") & vbNewLine & "City, State, Zip: " &
Request.Form("city") & vbNewLine & "Phone Number: " & Request.Form("phone") &
vbNewLine & "Email: " & Request.Form("email")
'prepare email to send
Set theMail = server.CreateObject("CDONTS.NewMail")
theMail.From = "info@bestdjs.info"
theMail.To = "info@bestdjs.info"
theMail.Subject = "Request to Joing Mailing List From Website"
theMail.BodyFormat = 1
theMail.Importance = 2
theMail.Body = strBody1
theMail.Send
Set theMail = Nothing
%>
<body bgcolor="9900AA">
<P align=center> </P>
<P align=center><FONT color="#FFFFFF" size="3" face=Trebuchet MS><strong><font
face="Arial, Helvetica, sans-serif">Thank
you!<BR>
</font><FONT color="#FFFFFF" size="3" face=Trebuchet MS><strong><font
face="Arial, Helvetica, sans-serif">.
. . . . . . . . . . . . . . . . . .</font></strong></FONT> . . . . . . . .
<font face="Arial, Helvetica, sans-serif"><BR>
BestDjs.com will contact you shortly<br>
. . . . . . . . . . . . . . . . . . .<br>
</font></strong></FONT><font color="#FFFFFF" size="3" face="Arial,
Helvetica, sans-serif"><strong>Press
your back button to return to our website.</strong></font></P>
</body>
| |
| OlDirty 2005-07-05, 11:18 pm |
| Thanks Joe! I think I need to show you the code for the form itself, don't I?
That's where the validation would come in right?
The code I sent previously was from the formail.asp. Sorry, I wish I would
have gone to school fro this. Self-taught isn't always the best way to go.
Here's the form code:
<form action=http://www.bestdjs.info/Forms/formmail_mailinglist.asp
method=post
name=NexGen
onSubmit="MM_validateForm('firstname','','R','lastname','','R','email','','RisEm
ail');return document.MM_returnValue">
<div align=center>
<table width="571" align=center cellpadding="3" cellspacing="2">
<tr valign="middle" align="center">
<td colspan="2" height="2" valign="middle"
align="center"> </td>
</tr>
<tr valign="middle" align="center">
<td colspan="2" height="2" valign="middle" align="center">
<h1>Join
Our Mailing List</h1></td>
</tr>
<tr valign="middle" align="center">
<td colspan="2" height="2" valign="middle"
align="center"><p><span style="font-family: Arial"><font
color="#CC0033">*</font></span>required
field</p></td>
</tr>
<tr>
<td height="26" colspan="2"> <div align="center">
<h1><font color="#cc6600"><img src="../images/cont_head.jpg"
alt="Contact Information" width="299" height="43"></font></h1>
</div></td>
</tr>
<tr>
<td width="41%"> <p><span style="font-family: Arial"><font
color="#CC0033">*</font>First
Name:</span></p></td>
<td width="59%" height="26"><font size="5" face="Verdana"
color="#cc6600">
<input name="firstname" type="text" id="firstname" value=""
size="50">
</font></td>
</tr>
<tr>
<td> <p><span style="font-family: Arial"><font
color="#CC0033">*</font></span>Last
Name: </p></td>
<td height="26"><font size="5" face="Verdana" color="#cc6600">
<input name="lastname" type="text" id="lastname" value=""
size="50">
</font></td>
</tr>
<tr>
<td> <p>Address: </p></td>
<td height="26"> <p><font size="5" face="Verdana"
color="#cc6600">
<input name="address" type="text" id="address" value=""
size="50">
</font></p></td>
</tr>
<tr>
<td> <p><span style="font-family: Arial"></span>City, State,
Zip:
</p></td>
<td height="26"> <p><font size="5" face="Verdana"
color="#cc6600">
<input name="city" type="text" id="citystatezip" value=""
size="50">
</font></p></td>
</tr>
<tr>
<td> <p><span style="font-family: Arial"></span>Phone Number:
</p></td>
<td height="26"><font size="5" face="Verdana" color="#cc6600">
<input name="phone" type="text" id="phone" value="" size="50">
</font></td>
</tr>
<tr>
<td> <p><span style="font-family: Arial"><font
color="#CC0033">*</font></span>Email
address:</p></td>
<td height="26"><font size="5" face="Verdana" color="#cc6600">
<input name="email" type="text" id="email" value="" size="50">
</font></td>
</tr>
<tr>
<td height="26" colspan="2"> <p align="center"><font size="2"
face="Verdana" color="#cc6600"><strong>
<input name=B13 type=submit value="Submit">
<input name=B23 type=reset value="Clear Form">
</strong></font><font size="5" face="Verdana"
color="#cc6600">
</font></p></td>
</tr>
<tr align="left">
<td height="26" colspan="2" valign="middle"> <p
align="center">Copyright
2005 BestDjs.info</p></td>
</tr>
</table>
</div>
<p align=center><font size="2" face="Verdana"
color="#cc6600"></font></p>
</form>
| |
| Joe Makowiec 2005-07-05, 11:25 pm |
| On Tue 05 Jul 2005 07:08:09p, OlDirty wrote in macromedia.dreamweaver:
> Thanks Joe! I think I need to show you the code for the form itself,
> don't I? That's where the validation would come in right?
Nope; the code I gave you would go in the script where you process the
form. The basic outline of it is:
// Do validation here
If (stuff is missing) {
// Give an error message }
Else {
// Process the information and send the email }
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|