Forums
This topic is locked
VB Help
Posted 18 Mar 2004 00:27:58
1
has voted
18 Mar 2004 00:27:58 Jack Cider posted:
Hi... I have an ASP page that calls in a bunch of data from an HTML Form. Each piece of data is assigned it's own variable. As part of my form, I want people to enter a password twice (for confirmation) and I want my code to be able to compare the data entered into those two fields before it processes the form. Here is the part of my code that is giving me trouble:IF strName <> " " AND Address1<> " " AND City <> " " AND strState <> " " AND Zip_Code <> " " AND Country <> " " AND Login <> " " AND Pass <> " " AND Email_Address <> " " THEN
IF Pass = Passchk THEN
data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("dbReinventions.mdb"
sql_insert = "insert into Constituents (Name, Address1, Address2, City, State, Zip_Code, Country, Gender, Birthday, Login, [Password], Website, Email_Address, Home_Phone, Mobile_Phone, Business_Phone1, Business_Phone2, Fax_No) values ('" & _
strName & "', '" & Address1 & "', '" & Address2 & "', '" & City & "', '" & strState & "', '" & Zip_Code & "', '" & Country & "', '" & Gender & "', '" & Birthday & "', '" & Login & "', '" & Pass & "', '" & Website & "', '" & Email_Address & "', '" & Home_Phone & "', '" & Mobile_Phone & "', '" & Business_Phone1 & "', '" & Business_Phone2 & "', '" & Fax_No & "')"
' Creating Connection Object and opening the database
Set con = Server.CreateObject("ADODB.Connection"
con.Open data_source
con.Execute sql_insert
' Done. Close the connection
con.Close
Set con = Nothing
Response.Write "Thank you for registering."
ELSE
Response.Write "<p>Submission failed.</p>"
Response.Write "<p>Please click Back on your browser and complete the following fields:</p>"
IF strName = " " THEN
Response.Write "<b>Name</b><br>"
END IF
IF Address1 = " " THEN
Response.Write "<b>Address (Line 1)</b><br>"
END IF
IF City = " " THEN
Response.Write "<b>City</b><br>"
END IF
IF strState = " " THEN
Response.Write "<b>State</b><br>"
END IF
IF Zip_Code = " " THEN
Response.Write "<b>Zip Code</b><br>"
END IF
IF Country = " " THEN
Response.Write "<b>Country</b><br>"
END IF
IF Email_Address = " " THEN
Response.Write "<b>E-mail</b><br>"
END IF
IF Login = " " THEN
Response.Write "<b>You must choose a login name</b><br>"
END IF
IF Pass = " " THEN
Response.Write "<b>You must choose a password</b><br>"
END IF
IF Pass <> Passchk THEN
Response.Write "<b>Your password cannot be confirmed. Please retype your exact password under 'Confirm Password.'</b><br>"
END IF
END IF
END IF
%>
Hope this is readable. I'm pretty much a newbie at this so I've been kind of winging it with the help of Open Source. Any help is appreciated.
Jack
Replies
Replied 18 Mar 2004 17:45:21
18 Mar 2004 17:45:21 Rene Bandsma replied:
What kind of error do you get? When it is only for the comparison of the two editboxes I should use a JavaScript file.
Replied 20 Mar 2004 20:55:29
20 Mar 2004 20:55:29 Phil Shevlin replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
What kind of error do you get? When it is only for the comparison of the two editboxes I should use a JavaScript file.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>No doubt. Form validation is much easier done at client side (JS). Yaromat.com has a good DMX extension for this.
What kind of error do you get? When it is only for the comparison of the two editboxes I should use a JavaScript file.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>No doubt. Form validation is much easier done at client side (JS). Yaromat.com has a good DMX extension for this.