Click to See Complete Forum and Search --> : Validation not working in ASP


coder40
11-10-2010, 11:08 PM
I have validated my form

and not working...how do I check that my form is working before uploading it to the server?


********************HTML***********************************


<form method="post" action="codsys.asp" method="post">
<fieldset>
<legend>Personal Details:</legend>
<label>First Name: <input type="text" name="firstname" /></label>
<label>Last Name: <input type="text" name="lastname" /></label>
<label>House Address: <input type="text" name="houseaddress" /></label>
<label>Street: <input type="text" name="street" /></label>
<label>City: <input type="text" name="city" /></label>
<label>Pin Code: <input type="text" name="pincode" /></label>
<label>Mobile Number: <input type="number" name="mobilenumber" /></label>
<label>Comments :</label><textarea rows="10" name="Comments" cols="20"></textarea>
</textarea></label>
</fieldset>
<br>
<input name="email_subject" type="hidden" value="Subject of email" />
<input name="redirect_to" type="hidden" value="redirect_to.htm" />
<input type="reset" name="Reset" value="Reset" />
<input name="send" type="submit" value="Submit" />
</form>



*********************ASP**********************************

<%
'Dimension variables
'Dim objcdosysCon , objcdosysmail, Body
Dim myCon , mymail, Body
'Create the e-mail server object
Set mymail = server.CreateObject("CDO.Message")
Set myCon = server.CreateObject ("CDO.Configuration")



'Out going SMTP server
myCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1"
myCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
myCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
myCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
myCon.Fields.Update

DIM strfirstname, strlastname, strhouseaddress, strstreet, strcity, strpincode, strmobilenumber , strcomments
strfirstname = Request.Form("firstname")
strlastname = Request.Form("lastname")
strhouseaddress = Request.Form("houseaddress")
strstreet = Request.Form("street")
strcity = Request.Form("city")
strpincode = Request.Form("pincode")
strmobilenumber = Request.Form("mobilenumber")
strcomments = Request.Form("comments")

IF strfirstname <> "" AND strlastname <> "" AND strhouseaddress <> "" AND strstreet <> "" AND strcity <> "" AND strpincode <> "" AND strmobilenumber <> "" AND strcomments <> "" THEN

' Process the form as you like here
' For example enter form to your database or send it via email

Update the cdosys Configuration
Set mymail.Configuration = myCon
SMTP Server name : mail.domainname.com
SMTP Port number: 25
my@domainname.com and password

mymail.From = "my@domainname.com"
mymail.To = "my@domainname.com"
mymail.Subject = "Client Information from the web"

ELSE

Response.Write "<p>Please click back on your browser and complete the following fields:</p>"
IF strfirstname <> "" THEN
ELSE
Response.Write "<b>• Firstname</b><br>"
END IF
IF strlastname <> "" THEN
ELSE
Response.Write "<b>• Lastname</b><br>"
END IF
IF strhouseaddress <> "" THEN
ELSE
Response.Write "<b>• houseaddress</b><br>"
END IF
IF strstreet <> "" THEN
ELSE
Response.Write "<b>• street</b><br>"
END IF
IF strcity <> "" THEN
ELSE
Response.Write "<b>• City</b><br>"
END IF
IF strpincode <> "" THEN
ELSE
Response.Write "<b>• Pincode</b><br>"
END IF
IF strmobilenumber <> "" THEN
ELSE
Response.Write "<b>• Mobilenumber</b><br>"
END IF
IF strcomments <> "" THEN
ELSE
Response.Write "<b>• Comments</b><br>"
END IF

END IF


Body = "Dear " + "User"+ ","
Body = Body + " <html>"
Body = Body + " <body>"
Body = Body + "<p>Your mail script is working fine."
Body = Body + "...</p> "
Body = Body + "<p>First Name : "&Request.Form("firstname")&"</p>"
Body = Body + "<p>Last Name : "&Request.Form("lastname")&"</p>"
Body = Body + "<p>For House Address: "&Request.Form("houseaddress")&"</p>"
Body = Body + "<p>Street: "&Request.Form("street")&"</p>"
Body = Body + "<p>City: "&Request.Form("city")&"</p>"
Body = Body + "<p>Pin code: "&Request.Form("pincode")&"</p>"
Body = Body + "<p>Mobile Number: "&Request.Form("mobilenumber")&"</p>"
Body = Body + "</body></html> "


mymail.HTMLBody = Body
mymail.Send
'Close the server mail object
Set mymail = Nothing
Set myCon = Nothing
Response.Write("Your mail was sent")
%>

**************************END*****************************

Now the problem is that I don't get anything on the page :(

yamaharuss
11-11-2010, 04:58 AM
Double posting won't get your answer any quicker.

coder40
11-11-2010, 01:01 PM
Double posting won't get your answer any quicker.

Ran out of patience ....Yeah sorry for the double post .