Andrew
asked on
Validate form based on list of email addresses?
Hello, can someone help me to understand the best way to add the functionality to this script that will allow for searching a SQL table for a selected email address and if it matches, allow the form to submit, otherwise display an alert and do not allow form submission.
This is where the email address comes from that needs to be checked against the SQL UID field: document.DonateForm.txtEma il
TIA,
Andrew
This is where the email address comes from that needs to be checked against the SQL UID field: document.DonateForm.txtEma
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Language=VBscript Codepage="65001" %>
<% Response.Expires=0 %>
<!-- #include file="ASPConnection.inc" -->
<%
'----------------------------------- ---------- ---------- ---------- ---------- ---------- -----
' DB work
'----------------------------------- ---------- ---------- ---------- ---------- ---------- -----
Set oConn = Server.CreateObject("ADODB.Connectio n")
oConn.Open "Provider=sqloledb;" & _
"Data Source=SQL01;" & _
"Initial Catalog=***;" & _
"User Id=***;" & _
"Password=***"
Set rs = Server.CreateObject("ADODB.Recordset ")
sSQL = "SELECT UID FROM RegTypeFilter WHERE ID > 0"
rs.Open sSQL, oConn
aTableValues = rs.GetRows()
Dim iRowLoop, iColLoop
For iRowLoop = 0 to UBound(aTableValues, 2)
For iColLoop = 0 to UBound(aTableValues, 1)
Response.Write(aTableValues(iColLoop , iRowLoop) & "<br>")
Next 'iColLoop
Response.Write("<p>")
Next 'iRowLoop
'Dim arUID()
'linecount=0
'while not rs.eof
' linecount = linecount+1
' redim preserve arUID(LineCount)
' arUID(0) = rs("UID")
' rs.movenext
' response.write arUID(0)
'wend
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="IE=7" http-equiv="X-UA-Compatible" />
<title>The Donald Danforth Plant Science Center</title>
<!--Script links-->
<script src="../../../../../../../../scripts /AC_RunAct iveContent .js" type="text/javascript"></s cript>
<script src="scripts/jquery-1.5.1.min.js" type="text/javascript"></s cript>
<script src="scripts/jquery.infieldlabel.min .js" type="text/javascript"></s cript>
<script src="scripts/jquery.infieldlabel.js" type="text/javascript"></s cript>
<script src="scripts/jquery.validationEngine -en.js" type="text/javascript"></s cript>
<script src="scripts/jquery.validationEngine .js" type="text/javascript"></s cript>
<script src="scripts/jquery.limit-1.2.source .js" type="text/javascript"></s cript>
<!--CSS links-->
<link href="../../../../../../../../css/dd psc_global .css" rel="stylesheet" type="text/css" />
<link href="../../../../../../../../css/dd psc_home.c ss" rel="stylesheet" type="text/css" />
<link href="css/layout.css" rel="stylesheet" type="text/css" />
<link href="css/reset.css" rel="stylesheet" type="text/css" />
<link href="css/validationEngine.jquery.cs s" rel="stylesheet" type="text/css" />
<!--Embedded CSS-->
<style type="text/css">
form td {
position: relative;
}
label {
position: absolute;
}
div.centered table {
margin: 0 auto;
text-align: left;
}
#wrapper {
width: 515px;
margin: 0 auto;
}
#inputArea {
font-family: Arial, Sans-Serif;
font-size: 10pt;
background-color: #DDDDDD;
padding: 15px;
}
.FormSectionHeader {
border-bottom: #000000 thin solid;
font-family: Arial, Helvetica, sans-serif;
color: black;
font-size: 10pt;
font-weight: bold;
}
.FormSectionRows {
font-family: Arial, Helvetica, sans-serif;
color: black;
height: 35px;
}
.FormSectionHeaderSpacer {
font-family: Arial, Helvetica, sans-serif;
height: 13px;
}
.FormSectionDonationInfoRow {
font-family: Arial, Helvetica, sans-serif;
color: black;
font-size: 10pt;
font-weight: bold;
}
.HiddenDiv {
display: none;
}
.DisplayDiv {
display: inherit;
}
.auto-style2 {
color: #000000;
}
.auto-style4 {
font-size: small;
}
#myTrap {
display: none;
}
</style>
<script type="text/javascript">
function validateRegType()
{
var PayHow = '';
var frm = document.DonateForm;
for (var index = 0; index < frm.PayHow.length; index++ )
if( frm.PayHow[ index ].checked )
PayHow = frm.PayHow[ index ].value
if (PayHow==null || PayHow=="")
{
alert("You are not authorized to select that registration type. Please select another.");
return false;
}
}
</script>
</head>
<body>
<center>
<!--#include virtual ="/header.asp"-->
<table cellpadding="0" cellspacing="0" width="900">
<tr>
<td height="100" width="900">
<img border="0" src="../GCP21-II/images/banner_GCP21 .jpg" width="900" />
</td>
</tr>
</table>
<br />
<table background-color="fff" border="0" cellpadding="0" cellspacing="0" class="container_content_nobackgroun d" width="900">
<tr>
<td align="left" valign="top" width="180"><br />
<br />
<!--#include virtual ="/menus/menu_GCP21.asp"--></td>
<td align="left" valign="top" width="650">
<script src="../../../../../../../../scripts /breadcrum bs.js" type="text/javascript"></s cript>
<!-- begin content area -->
<div id="wrapper">
<div id="inputArea">
<form id="DonateForm" name="DonateForm" action="GCP21Reg.asp" onsubmit="return validateRegType()" class="formular" method="post">
<textarea id="myTrap" cols="1" name="myTrap" rows="1"></textarea>
<table style="width: 100%;">
<tr>
<td class="FormSectionHeader">Select Registration Type* <font color="#CC0000"><strong>(R EQUIRED TO CONTINUE)</strong></font>< /td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer">&nbs p;</td>
</tr>
<tr>
<td class="FormSectionRows">
<input class="validate[required] radio" id="Rad1" name="PayHow" type="radio" value="Registrant" />Standard Registrant ($350.00 USD. Payment required upon registration)<br />
<input class="validate[required] radio" id="Rad2" name="PayHow" type="radio" value="InvSpeaker" />Invited Speaker<br />
<input class="validate[required] radio" id="Rad3" name="PayHow" type="radio" value="TravelGrant" />Travel Grant (You must register first on this page and complete the next page before leaving the website or your Travel Grant application will not be valid. You will submit your abstract in the "Post-Registration" section later when it is ready)<br />
<input class="validate[required] radio" id="Rad4" name="PayHow" type="radio" value="ConfOrg" />Conference Organizer </td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer">&nbs p;</td>
</tr>
<tr>
<td class="FormSectionHeader">Contact Information*</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer">&nbs p;</td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtFName"> First
Name*</label><input id="txtFName" class="validate[required] text-input" name="txtFName" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtMName"> Middl e
Name</label><input id="txtMName" name="txtMName" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtLName"> Last
Name*</label><input id="txtLName" class="validate[required] text-input" name="txtLName" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtEmail"> Email
Address*</label><input id="txtEmail" class="validate[required,custom[emai l]] text-input" name="txtEmail" size="35" type="text" value="" /></td>
<br />
<br />
</tr>
<tr>
<td class="FormSectionRows">
<input class="bigcheck" name="optSex" type="radio" value="Female" />Female
<input class="bigcheck" name="optSex" type="radio" value="Male" />Male</td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtNat"> Nationa lity</labe l><input id="txtNat" name="txtNat" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtSOrg"> Instit ute/Organi zation</la bel><input id="txtSOrg" name="txtSOrg" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows"><label for="bill_add"> Addre ss*</label ><input id="bill_add" class="validate[required] text-input" name="bill_add" size="50" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtBill_City"> City*</labe l><input id="txtBill_City" class="validate[required] text-input" name="txtBill_City" size="20" type="text" value="" />
<select id="cboBill_State" class="validate[required]"name="cboBill_State">
<option value="">State*</option>
<option value="NUS">Non US</option>
<option value="AL">AL</option>
<option value="AK">AK</option>
<option value="AZ">AZ</option>
<option value="AR">AR</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DE">DE</option>
<option value="DC">DC</option>
<option value="FL">FL</option>
<option value="GA">GA</option>
<option value="HI">HI</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="IA">IA</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="ME">ME</option>
<option value="MD">MD</option>
<option value="MA">MA</option>
<option value="MI">MI</option>
<option value="MN">MN</option>
<option value="MS">MS</option>
<option value="MO">MO</option>
<option value="MT">MT</option>
<option value="NE">NE</option>
<option value="NV">NV</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>
<option value="NY">NY</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PA">PA</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VT">VT</option>
<option value="VA">VA</option>
<option value="WA">WA</option>
<option value="WV">WV</option>
<option value="WI">WI</option>
<option value="WY">WY</option>
</select> <label for="bBill_zip"> Zip< /label><in put id="bBill_zip" class="validate[minSize[5] ] text-input" name="bBill_zip" size="6" style="width: 44px" type="text" value="" />
<br />
* Non-US citizens - please select non-US option in the state drop down<br />
<br />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtBill_Con"> Country*</la bel><input id="txtBill_Con" class="validate[required] text-input" name="txtBill_Con" size="50" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="night_phone_a">Phone*</label><i nput id="night_phone_a" class="validate[required,m inSize[3]] text-input" name="night_phone_a" size="3" type="text" value="" /> - <label for="night_phone_b"></labe l><input id="night_phone_b" class="validate[required,m inSize[3]] text-input" name="night_phone_b" size="3" type="text" value="" /> - <label for="night_phone_c"></labe l><input id="night_phone_c" class="validate[required,m inSize[4]] text-input" name="night_phone_c" size="3" type="text" value="" /> <input class="bigcheck" name="optPhoneType" type="radio" value="Home" />Home <input class="bigcheck" name="optPhoneType" type="radio" value="Business" />Business <input class="bigcheck" name="optPhoneType" type="radio" value="Cell" />Cell</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="fax_phone_a">Fax</label><input id="fax_phone_a" name="fax_phone_a" size="3" type="text" value="" /> -
<label for="fax_phone_b"></label>
<input id="fax_phone_b" name="fax_phone_b" size="3" type="text" value="" /> -
<label for="fax_phone_c"></label>
<input id="fax_phone_c" name="fax_phone_c" size="3" type="text" value="" />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<input id="ParticList" name="ParticList" type="checkbox" value="Yes, exclude from list" />
Please click here if you want to be EXCLUDED from participant list</td>
</tr>
<tr>
<td class="FormSectionHeader">Password* <font color="#CC0000"><strong>(R EQUIRED)</ strong></f ont></td>
</tr>
<tr>
<td class="FormSectionRows"><br />
Post-Registration Information:<br />
You will need a password to enter the Post-Registration
portal where you will load<br />
your abstract, register your guests and enter your arrival/departure
information for yourself and your guests.<br />
<br />
<label for="txtPswrd"> Password*</labe l><input id="txtPswrd" class="validate[required] text-input" name="txtPswrd" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer">&nbs p;</td>
</tr>
<tr>
<td class="FormSectionHeader">Persons to Contact in
Case of an Emergency*</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer">&nbs p;</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtEmerCont"> Name*</label ><input id="txtEmerCont" class="validate[required] text-input" name="txtEmerCont" size="35" type="text" value="" />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="emer_phone_a">Phone*</label><in put id="emer_phone_a" class="validate[required,m inSize[3]] text-input" name="emer_phone_a" size="3" type="text" value="" /> - <label for="emer_phone_b"></label ><input id="emer_phone_b" class="validate[required,m inSize[3]] text-input" name="emer_phone_b" size="3" type="text" value="" /> - <label for="emer_phone_c"></label ><input id="emer_phone_c" class="validate[required,m inSize[4]] text-input" name="emer_phone_c" size="3" type="text" value="" /> <input class="bigcheck" name="optEmerPhoneType" type="radio" value="Home" />Home <input class="bigcheck" name="optEmerPhoneType" type="radio" value="Business" />Business <input class="bigcheck" name="optEmerPhoneType" type="radio" value="Cell" />Cell
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtEmerCoun"> Country*</la bel><input id="txtEmerCoun" class="validate[required] text-input" name="txtEmerCoun" size="35" type="text" value="" />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtEmerCont2"> Name*</labe l><input id="txtEmerCont2" class="validate[required] text-input" name="txtEmerCont2" size="35" type="text" value="" />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="emer_phone_a2">Phone*</label><i nput id="emer_phone_a2" class="validate[required,m inSize[3]] text-input" name="emer_phone_a2" size="3" type="text" value="" /> - <label for="emer_phone_b2"></labe l><input id="emer_phone_b2" class="validate[required,m inSize[3]] text-input" name="emer_phone_b2" size="3" type="text" value="" /> - <label for="emer_phone_c2"></labe l><input id="emer_phone_c2" class="validate[required,m inSize[4]] text-input" name="emer_phone_c2" size="3" type="text" value="" /> <input class="bigcheck" name="optEmerPhoneType2" type="radio" value="Home" />Home <input class="bigcheck" name="optEmerPhoneType2" type="radio" value="Business" />Business <input class="bigcheck" name="optEmerPhoneType2" type="radio" value="Cell" />Cell
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtEmerCoun2"> Country*</l abel><inpu t id="txtEmerCoun2" class="validate[required] text-input" name="txtEmerCoun2" size="35" type="text" value="" />
</td>
</tr>
<tr>
<td class="FormSectionHeader">Additional Information</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer">&nbs p;</td>
</tr>
<tr>
<td class="FormSectionRows">Special Needs Including Dietary Requests:<br />
<br />
<textarea id="txtSpecNeeds" name="txtSpecNeeds" rows="3" cols="50"></textarea><br />
<span id="charsLeft"></span> characte rs left.
<script type="text/javascript">
$('#txtSpecNeeds').limit('3000', '#charsLeft');
</script>
</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer">&nbs p;</td>
</tr>
<tr>
<td class="FormSectionHeader"><strong>My Occupation*</strong></td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer">&nbs p;</td>
</tr>
<tr>
<td class="FormSectionRows">
<input class="validate[required] radio" id="RadStud" name="myOcc" type="radio" value="Student" />Student<br />
<input class="validate[required] radio" id="RadTech" name="myOcc" type="radio" value="Tech" />Technician<br />
<input class="validate[required] radio" id="RadYoung" name="myOcc" type="radio" value="YoungScientist" />Young Scientist<br />
<input class="validate[required] radio" id="RadSci" name="myOcc" type="radio" value="Scientist" />Scientist<br />
<input class="validate[required] radio" id="RadOther" name="myOcc" type="radio" value="Other" />Other:
<input id="txtOth" class="text-input" name="txtOth" size="35" type="text" value="" /><br />
</td>
</tr>
<tr>
<td class="FormSectionHeader"><br />
Select sessions you are interested in attending: (Check all that apply)</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer">&nbs p;</td>
</tr>
<tr>
<td class="FormSectionRows">
<input id="S1" name="S1" type="checkBox" value="Yes" />S1 Biodiversity and Genetic Resources<br />
<input id="S2" name="S2" type="checkBox" value="Yes" />S2 Climate and Social Changes Impacting Cassava<br />
<input id="S3" name="S3" type="checkBox" value="Yes" />S3 Genomics and Gene Discovery Platforms<br />
<input id="S4" name="S4" type="checkBox" value="Yes" />S4 Agronomy (Cassava Field Production)<br />
<input id="S5" name="S5" type="checkBox" value="Yes" />S5 CBSD and CMD and CBB<br />
<input id="S6" name="S6" type="checkBox" value="Yes" />S6 Enabling Transgenic and In vitro Technologies (includes haploids)<br />
<input id="S7" name="S7" type="checkBox" value="Yes" />S7 Physiology and Abiotic stress (includes PPD)<br />
<input id="S8" name="S8" type="checkBox" value="Yes" />S8 Modern Breeding (includes MAS, heterosis, transgenics)<br />
<input id="S9" name="S9" type="checkBox" value="Yes" />S9 Field Breeding<br />
<input id="S10" name="S10" type="checkBox" value="Yes" />S10 Metabolic Engineering (includes starch, biofuels, nutritional enhancement)<br />
<input id="S11" name="S11" type="checkBox" value="Yes" />S11 Cassava Delivery Chain<br />
<input id="S12" name="S12" type="checkBox" value="Yes" />S12 Cassava Value Chain<br />
<input id="S13" name="S13" type="checkBox" value="Yes" />S13 Cassava Genomics Workshop<br />
<br />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<input id="chkPremiss" name="chkPremiss" type="checkbox" value="Yes" />
I give permission to have my name, photos, abstract and presentation on the GCP21 website and in the conference proceedings.<br />
</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer">&nbs p;</td>
</tr>
<tr>
<td class="FormSectionHeader">Generation Challenge Program IBP Satellite Meeting, June 23-24, 2012</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer">&nbs p;</td>
</tr>
<tr>
<td class="FormSectionRows">
<input id="chkSatil" name="chkSatil" type="checkbox" value="Yes" />
I would like to attend<br />
<br />
If you would like to receive more information about the Generation Challenge Program IBP Satellite Meeting, <a href="/GCP21-II/satellite.asp">click here</a><br />
</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer">&nbs p;</td>
</tr>
<tr>
<td class="FormSectionHeader"><strong>Gu ests</stro ng>
</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer">&nbs p;</td>
</tr>
<tr>
<td class="FormSectionRows">Number of guests I plan
on bringing:
<input id="txtRegGues" class="text-input" name="txtRegGues" size="3" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer">&nbs p;</td>
</tr>
<tr>
<td class="FormSectionHeader"><strong>Ho tel Information</strong></td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer">&nbs p;</td>
</tr>
<tr>
<td class="FormSectionRows">
<input id="chkSecDep" class="validate[required]"name="chkSecDep" type="checkbox" value="Yes" />
I agree to provide the hotel with either my credit card
or US $50 upon arrival as security deposit against
any incidentals (such as phone calls, mini bar, movies,
laundry and extra meals) in addition to the room charge.</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer">&nbs p;</td>
</tr>
<tr>
<td><br />
<input name="Next" type="submit" value="Next" /></td>
</tr>
</table>
</form>
</div>
</div>
<small>This page updated 2/7/2012</small>
</td>
<td align="left" valign="top" width="180">
<div class="container_content_right">
<br />
<!--#include virtual ="/sidebars/sidebar-science.asp"-->< /div>
</td>
</tr>
</table>
<!--#include virtual ="/footer.asp"--></center>
</body>
</html>
<!--#include virtual ="/footer.asp"--></center>
</body>
</html>
TIA,
Andrew
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I do not want to leave the form page to process the validation.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You will stay on the page with or without ajax.
Without ajax you will have your page set up like this
----------------------
<%
If request.form("txtEmail")<> "" 'test to see if form is submitted with data. You can use any field to test for the form submission. This way when the page loads without the form, the steps below get skipped
'process form data
' step 1 - look up email in the database using request.form("txtEmail") as the query filter
'create recordset
' check if rs is null or valid
' step 2.1 - if we find the email then process the form
' send to "thank you" page
' step 2.2 - if we don't find the email then create an error message to display on the form
end if 'request.form("txtEmail")< >"" so just go to the form
%>
<form>
form goes here below the process data code
</form>
--------------------
Both this solution and the ajax solution above will do the trick. With this solution you will "see" a page refresh but everything is done on page. With the ajax solution everything is done behind the scenes while it accesses outside info. Each solution has good reasons to use it and drawbacks.
Without ajax you will have your page set up like this
----------------------
<%
If request.form("txtEmail")<>
'process form data
' step 1 - look up email in the database using request.form("txtEmail") as the query filter
'create recordset
' check if rs is null or valid
' step 2.1 - if we find the email then process the form
' send to "thank you" page
' step 2.2 - if we don't find the email then create an error message to display on the form
end if 'request.form("txtEmail")<
%>
<form>
form goes here below the process data code
</form>
--------------------
Both this solution and the ajax solution above will do the trick. With this solution you will "see" a page refresh but everything is done on page. With the ajax solution everything is done behind the scenes while it accesses outside info. Each solution has good reasons to use it and drawbacks.
ASKER
@ padas
Do I need to change the action of the form to POST to itself then?? I am missing something here. Also, how then would I figure out what radio button was selected for RegType id="Rad1" name="PayHow" ? The email address lookup only needs to occur if either one of 2 of the 4 types is selected.
Thanks for your help.
Do I need to change the action of the form to POST to itself then?? I am missing something here. Also, how then would I figure out what radio button was selected for RegType id="Rad1" name="PayHow" ? The email address lookup only needs to occur if either one of 2 of the 4 types is selected.
Thanks for your help.
ASKER
@The_Big_Daddy
Thank you for your help as well. I will research your method while waiting on a reply from padas.
Thank you for your help as well. I will research your method while waiting on a reply from padas.
You can either leave the form action blank or use the current page name (GCP21Reg.asp).
To see if payhow is submitted you can use <% if request.form("PayHow")<>"" then ....%> Another option is to create a new hidden field on the form, maybe call it "submitform" with the value of "yes". Then you can use <% if request.form("submitform") ="yes" then... %>
To see if payhow is submitted you can use <% if request.form("PayHow")<>""
ASKER
I think I am making progress using another method but I still need to loop through the array I passed from VBscript(ASP) to this javascript function that fires off at form submit.
<script type="text/javascript">
function validateRegType()
{
var theList = arrUserInfo2D;
var PayHow = '';
var frm = document.DonateForm;
for (var index = 0; index < frm.PayHow.length; index++ )
if( frm.PayHow[ index ].checked )
PayHow = frm.PayHow[ index ].value
if (PayHow=="InvSpeaker" || PayHow=="ConfOrg")
{
alert("You are not authorized to select that registration type.");
return false;
}
}
</script>
ASKER
I am using this:
<%
'*********************************** ********** **** ************************** *******
'Name : VB2JSarray2D.inc
'Description : Include File used to convert a VBScript Two Dimensional Array to Two Dimensional Javascript Array
'Developer : Anand Venkatraman
'Creation Date : 03/31/2000
'*********************************** ********** **** ************************** ********
'This function converts a VBScript Array to Javascript Array(Two Dimensional array only)
'Inputs are VBScript array and Javascript array name
'For the sake of variable names "mismatch", "vb2js" is prefixed to all the variables
'For eg. in ASP page you might call this function as "Call ConvertToJSArray(arrUserList,"arrUse rList")
'When this function is called immediately Javascript array is created and written to the web page
'So we cannot use Response.Redirect after calling this function. You can View the Source of HTML page
'to see the Javascript array.
Function ConvertToJSArray2D(VBArray, ArrayName)
Dim vb2jsRow, vb2jsCol , vb2jsStr, vb2jsi, vb2jsj
vb2jsRow = Ubound(VBArray,1)
vb2jsCol = Ubound(VBArray,2)
%>
<SCRIPT LANGUAGE = 'JAVASCRIPT' >
var vb2jsi,vb2jsj
<%=ArrayName%> = new Array(<%=vb2jsRow+1%>);
for (vb2jsi=0; vb2jsi < <%=vb2jsRow+1%>; vb2jsi++)
{
<%=ArrayName%>[vb2jsi] = new Array(<%=vb2jsCol+1%>)
for (vb2jsj=0; vb2jsj < <%=vb2jsCol+1%>; vb2jsj++) <%=ArrayName%>[vb2jsi][vb2jsj] = " "
}
</SCRIPT>
<%
Response.Write("<SCR"&"IPTLANGUAGE = 'JAVASCRIPT' >"&chr(13))
for vb2jsi=0 to vb2jsRow
for vb2jsj=0 to vb2jsCol
vb2jsstr = "VBArray("&vb2jsi&","&vb2jsj&")"
%>
<%=ArrayName%>[<%=vb2jsi%>][<%=vb2js j%>] = "<%=trim(eval(vb2jsstr))%> "
<%
Next
Next
Response.Write("</SCR"&"IPT>")
End Function
%>
ASKER
And this is the vbscript array I am passing it:
Set rs = Server.CreateObject("ADODB .Recordset ")
sSQL = "SELECT UID FROM RegTypeFilter WHERE ID > 0"
rs.Open sSQL, oConn
aTableValues = rs.GetRows()
Call ConvertToJSArray2D(aTableV alues,"arr UserInfo2D ")
Set rs = Server.CreateObject("ADODB
sSQL = "SELECT UID FROM RegTypeFilter WHERE ID > 0"
rs.Open sSQL, oConn
aTableValues = rs.GetRows()
Call ConvertToJSArray2D(aTableV
ASKER
Can you help me with the best way to loop through the array and check to see if the email address entered into the form matches anything in the array?
<script type="text/javascript">
function validateRegType()
{
var theList = arrUserInfo2D;
var PayHow = '';
var frm = document.DonateForm;
for (var index = 0; index < frm.PayHow.length; index++ )
if( frm.PayHow[ index ].checked )
PayHow = frm.PayHow[ index ].value
if (PayHow=="InvSpeaker" || PayHow=="ConfOrg")
{
// LOOP THROUGH ARRAY AND CHECK FOR MATCHES FOR txtEmail.value
alert("You are not authorized to select that registration type.");
return false;
}
}
</script>
I think that is making more complex then it needs to be. If you look in the step 1 where I have:
' step 1 - look up email in the database using request.form("txtEmail") as the query filter
'create recordset
' check if rs is null or valid
You will simply do this
Set rs = Server.CreateObject("ADODB .Recordset ")
sSQL = "SELECT UID FROM RegTypeFilter WHERE ID = request.form("MyFormField" )"
rs.Open sSQL, oConn
Now lets see if the person that filled out the form has the proper authorization.
errormessage=""
if not rs.bof or not rs.eof then
'if there is data we know it is ok
else
'they are not in the database so create an error message
errormessage = "You are not authorized to select that registration type"
end if
Then on your form
<form>
<%
response.write errormessage 'this will only show up if the form was submitted and the were not in the database
%>
:
:
</form>
Doing this, instead of having to use a pop up, you can make a nice looking message on the form. I may have the table name of field wrong here but just replace with the correct one.
' step 1 - look up email in the database using request.form("txtEmail") as the query filter
'create recordset
' check if rs is null or valid
You will simply do this
Set rs = Server.CreateObject("ADODB
sSQL = "SELECT UID FROM RegTypeFilter WHERE ID = request.form("MyFormField"
rs.Open sSQL, oConn
Now lets see if the person that filled out the form has the proper authorization.
errormessage=""
if not rs.bof or not rs.eof then
'if there is data we know it is ok
else
'they are not in the database so create an error message
errormessage = "You are not authorized to select that registration type"
end if
Then on your form
<form>
<%
response.write errormessage 'this will only show up if the form was submitted and the were not in the database
%>
:
:
</form>
Doing this, instead of having to use a pop up, you can make a nice looking message on the form. I may have the table name of field wrong here but just replace with the correct one.
ASKER
Ok, like so? I have a second processing page that writes all of this form data to a SQL table. How can I submit to that page using this method? Or do I need to move that piece of code over to this page?
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Language=VBscript Codepage="65001" %>
<% Response.Expires=0 %>
<!-- #include file="ASPConnection.inc" -->
<% if request.form("txtEmail")<>"" then %>
<%
'------------------------------------------------------------------------------------------
' Declare vars
'------------------------------------------------------------------------------------------
sEmailLookup = request.form("txtEmail")
'------------------------------------------------------------------------------------------
' DB work
'------------------------------------------------------------------------------------------
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "Provider=sqloledb;" & _
"Data Source=SQL01;" & _
"Initial Catalog=***;" & _
"User Id=***;" & _
"Password=***"
Set rs = Server.CreateObject("ADODB.Recordset")
sSQL = "SELECT UID FROM RegTypeFilter WHERE UID = " & "'" & sEmailLookup & "'"
rs.Open sSQL, oConn
errormessage=""
if NOT rs.BOF AND NOT rs.EOF then
response.write ("MATCH FOUND")
else
response.write ("MATCH NOT FOUND")
errormessage = "You are not authorized to select that registration type"
end if
'aTableValues = rs.GetRows()
'Dim iRowLoop, iColLoop
'For iRowLoop = 0 to UBound(aTableValues, 2)
' For iColLoop = 0 to UBound(aTableValues, 1)
' Response.Write(aTableValues(iColLoop, iRowLoop) & "<br>")
' Next 'iColLoop
' Response.Write("<p>")
'Next 'iRowLoop
'Call ConvertToJSArray2D(aTableValues,"arrUserInfo2D")
%>
<% else %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="IE=7" http-equiv="X-UA-Compatible" />
<title>The Donald Danforth Plant Science Center</title>
<!--Script links-->
<script src="../../../../../../../../scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<script src="scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="scripts/jquery.infieldlabel.min.js" type="text/javascript"></script>
<script src="scripts/jquery.infieldlabel.js" type="text/javascript"></script>
<script src="scripts/jquery.validationEngine-en.js" type="text/javascript"></script>
<script src="scripts/jquery.validationEngine.js" type="text/javascript"></script>
<script src="scripts/jquery.limit-1.2.source.js" type="text/javascript"></script>
<!--CSS links-->
<link href="../../../../../../../../css/ddpsc_global.css" rel="stylesheet" type="text/css" />
<link href="../../../../../../../../css/ddpsc_home.css" rel="stylesheet" type="text/css" />
<link href="css/layout.css" rel="stylesheet" type="text/css" />
<link href="css/reset.css" rel="stylesheet" type="text/css" />
<link href="css/validationEngine.jquery.css" rel="stylesheet" type="text/css" />
<!--Embedded CSS-->
<style type="text/css">
form td {
position: relative;
}
label {
position: absolute;
}
div.centered table {
margin: 0 auto;
text-align: left;
}
#wrapper {
width: 515px;
margin: 0 auto;
}
#inputArea {
font-family: Arial, Sans-Serif;
font-size: 10pt;
background-color: #DDDDDD;
padding: 15px;
}
.FormSectionHeader {
border-bottom: #000000 thin solid;
font-family: Arial, Helvetica, sans-serif;
color: black;
font-size: 10pt;
font-weight: bold;
}
.FormSectionRows {
font-family: Arial, Helvetica, sans-serif;
color: black;
height: 35px;
}
.FormSectionHeaderSpacer {
font-family: Arial, Helvetica, sans-serif;
height: 13px;
}
.FormSectionDonationInfoRow {
font-family: Arial, Helvetica, sans-serif;
color: black;
font-size: 10pt;
font-weight: bold;
}
.HiddenDiv {
display: none;
}
.DisplayDiv {
display: inherit;
}
.auto-style2 {
color: #000000;
}
.auto-style4 {
font-size: small;
}
#myTrap {
display: none;
}
</style>
<script type="text/javascript">
function validateRegType()
{
// var theList = arrUserInfo2D;
var PayHow = '';
var frm = document.DonateForm;
for (var index = 0; index < frm.PayHow.length; index++ )
if( frm.PayHow[ index ].checked )
PayHow = frm.PayHow[ index ].value
if (PayHow=="InvSpeaker" || PayHow=="ConfOrg")
{
alert("You are not authorized to select that registration type.");
return false;
}
}
</script>
</head>
<body>
<center>
<!--#include virtual ="/header.asp"-->
<table cellpadding="0" cellspacing="0" width="900">
<tr>
<td height="100" width="900">
<img border="0" src="../GCP21-II/images/banner_GCP21.jpg" width="900" />
</td>
</tr>
</table>
<br />
<input id="Button1" type="button" value="button" onclick="validateRegType();"/>
<%
response.write errormessage 'this will only show up if the form was submitted and they were not in the database
%>
<table background-color="fff" border="0" cellpadding="0" cellspacing="0" class="container_content_nobackground" width="900">
<tr>
<td align="left" valign="top" width="180"><br />
<br />
<!--#include virtual ="/menus/menu_GCP21.asp"--></td>
<td align="left" valign="top" width="650">
<script src="../../../../../../../../scripts/breadcrumbs.js" type="text/javascript"></script>
<!-- begin content area -->
<div id="wrapper">
<div id="inputArea">
<form id="DonateForm" name="DonateForm" action="" class="formular" method="post">
<textarea id="myTrap" cols="1" name="myTrap" rows="1"></textarea>
<table style="width: 100%;">
<tr>
<td class="FormSectionHeader">Select Registration Type* <font color="#CC0000"><strong>(REQUIRED TO CONTINUE)</strong></font></td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows">
<input class="validate[required] radio" id="Rad1" name="PayHow" type="radio" value="Registrant" />Standard Registrant ($350.00 USD. Payment required upon registration)<br />
<input class="validate[required] radio" id="Rad2" name="PayHow" type="radio" value="InvSpeaker" />Invited Speaker<br />
<input class="validate[required] radio" id="Rad3" name="PayHow" type="radio" value="TravelGrant" />Travel Grant (You must register first on this page and complete the next page before leaving the website or your Travel Grant application will not be valid. You will submit your abstract in the "Post-Registration" section later when it is ready)<br />
<input class="validate[required] radio" id="Rad4" name="PayHow" type="radio" value="ConfOrg" />Conference Organizer </td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionHeader">Contact Information*</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtFName"> First
Name*</label><input id="txtFName" class="validate[required] text-input" name="txtFName" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtMName"> Middle
Name</label><input id="txtMName" name="txtMName" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtLName"> Last
Name*</label><input id="txtLName" class="validate[required] text-input" name="txtLName" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtEmail"> Email
Address*</label><input id="txtEmail" class="validate[required,custom[email]] text-input" name="txtEmail" size="35" type="text" value="" /></td>
<br />
<br />
</tr>
<tr>
<td class="FormSectionRows">
<input class="bigcheck" name="optSex" type="radio" value="Female" />Female
<input class="bigcheck" name="optSex" type="radio" value="Male" />Male</td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtNat"> Nationality</label><input id="txtNat" name="txtNat" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtSOrg"> Institute/Organization</label><input id="txtSOrg" name="txtSOrg" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows"><label for="bill_add"> Address*</label><input id="bill_add" class="validate[required] text-input" name="bill_add" size="50" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtBill_City"> City*</label><input id="txtBill_City" class="validate[required] text-input" name="txtBill_City" size="20" type="text" value="" />
<select id="cboBill_State" class="validate[required]" name="cboBill_State">
<option value="">State*</option>
<option value="NUS">Non US</option>
<option value="AL">AL</option>
<option value="AK">AK</option>
<option value="AZ">AZ</option>
<option value="AR">AR</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DE">DE</option>
<option value="DC">DC</option>
<option value="FL">FL</option>
<option value="GA">GA</option>
<option value="HI">HI</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="IA">IA</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="ME">ME</option>
<option value="MD">MD</option>
<option value="MA">MA</option>
<option value="MI">MI</option>
<option value="MN">MN</option>
<option value="MS">MS</option>
<option value="MO">MO</option>
<option value="MT">MT</option>
<option value="NE">NE</option>
<option value="NV">NV</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>
<option value="NY">NY</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PA">PA</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VT">VT</option>
<option value="VA">VA</option>
<option value="WA">WA</option>
<option value="WV">WV</option>
<option value="WI">WI</option>
<option value="WY">WY</option>
</select> <label for="bBill_zip"> Zip</label><input id="bBill_zip" class="validate[minSize[5]] text-input" name="bBill_zip" size="6" style="width: 44px" type="text" value="" />
<br />
* Non-US citizens - please select non-US option in the state drop down<br />
<br />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtBill_Con"> Country*</label><input id="txtBill_Con" class="validate[required] text-input" name="txtBill_Con" size="50" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="night_phone_a">Phone*</label><input id="night_phone_a" class="validate[required,minSize[3]] text-input" name="night_phone_a" size="3" type="text" value="" /> - <label for="night_phone_b"></label><input id="night_phone_b" class="validate[required,minSize[3]] text-input" name="night_phone_b" size="3" type="text" value="" /> - <label for="night_phone_c"></label><input id="night_phone_c" class="validate[required,minSize[4]] text-input" name="night_phone_c" size="3" type="text" value="" /> <input class="bigcheck" name="optPhoneType" type="radio" value="Home" />Home <input class="bigcheck" name="optPhoneType" type="radio" value="Business" />Business <input class="bigcheck" name="optPhoneType" type="radio" value="Cell" />Cell</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="fax_phone_a">Fax</label><input id="fax_phone_a" name="fax_phone_a" size="3" type="text" value="" /> -
<label for="fax_phone_b"></label>
<input id="fax_phone_b" name="fax_phone_b" size="3" type="text" value="" /> -
<label for="fax_phone_c"></label>
<input id="fax_phone_c" name="fax_phone_c" size="3" type="text" value="" />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<input id="ParticList" name="ParticList" type="checkbox" value="Yes, exclude from list" />
Please click here if you want to be EXCLUDED from participant list</td>
</tr>
<tr>
<td class="FormSectionHeader">Password* <font color="#CC0000"><strong>(REQUIRED)</strong></font></td>
</tr>
<tr>
<td class="FormSectionRows"><br />
Post-Registration Information:<br />
You will need a password to enter the Post-Registration
portal where you will load<br />
your abstract, register your guests and enter your arrival/departure
information for yourself and your guests.<br />
<br />
<label for="txtPswrd"> Password*</label><input id="txtPswrd" class="validate[required] text-input" name="txtPswrd" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionHeader">Persons to Contact in
Case of an Emergency*</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtEmerCont"> Name*</label><input id="txtEmerCont" class="validate[required] text-input" name="txtEmerCont" size="35" type="text" value="" />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="emer_phone_a">Phone*</label><input id="emer_phone_a" class="validate[required,minSize[3]] text-input" name="emer_phone_a" size="3" type="text" value="" /> - <label for="emer_phone_b"></label><input id="emer_phone_b" class="validate[required,minSize[3]] text-input" name="emer_phone_b" size="3" type="text" value="" /> - <label for="emer_phone_c"></label><input id="emer_phone_c" class="validate[required,minSize[4]] text-input" name="emer_phone_c" size="3" type="text" value="" /> <input class="bigcheck" name="optEmerPhoneType" type="radio" value="Home" />Home <input class="bigcheck" name="optEmerPhoneType" type="radio" value="Business" />Business <input class="bigcheck" name="optEmerPhoneType" type="radio" value="Cell" />Cell
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtEmerCoun"> Country*</label><input id="txtEmerCoun" class="validate[required] text-input" name="txtEmerCoun" size="35" type="text" value="" />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtEmerCont2"> Name*</label><input id="txtEmerCont2" class="validate[required] text-input" name="txtEmerCont2" size="35" type="text" value="" />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="emer_phone_a2">Phone*</label><input id="emer_phone_a2" class="validate[required,minSize[3]] text-input" name="emer_phone_a2" size="3" type="text" value="" /> - <label for="emer_phone_b2"></label><input id="emer_phone_b2" class="validate[required,minSize[3]] text-input" name="emer_phone_b2" size="3" type="text" value="" /> - <label for="emer_phone_c2"></label><input id="emer_phone_c2" class="validate[required,minSize[4]] text-input" name="emer_phone_c2" size="3" type="text" value="" /> <input class="bigcheck" name="optEmerPhoneType2" type="radio" value="Home" />Home <input class="bigcheck" name="optEmerPhoneType2" type="radio" value="Business" />Business <input class="bigcheck" name="optEmerPhoneType2" type="radio" value="Cell" />Cell
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtEmerCoun2"> Country*</label><input id="txtEmerCoun2" class="validate[required] text-input" name="txtEmerCoun2" size="35" type="text" value="" />
</td>
</tr>
<tr>
<td class="FormSectionHeader">Additional Information</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows">Special Needs Including Dietary Requests:<br />
<br />
<textarea id="txtSpecNeeds" name="txtSpecNeeds" rows="3" cols="50"></textarea><br />
<span id="charsLeft"></span> characters left.
<script type="text/javascript">
$('#txtSpecNeeds').limit('3000', '#charsLeft');
</script>
</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionHeader"><strong>My Occupation*</strong></td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows">
<input class="validate[required] radio" id="RadStud" name="myOcc" type="radio" value="Student" />Student<br />
<input class="validate[required] radio" id="RadTech" name="myOcc" type="radio" value="Tech" />Technician<br />
<input class="validate[required] radio" id="RadYoung" name="myOcc" type="radio" value="YoungScientist" />Young Scientist<br />
<input class="validate[required] radio" id="RadSci" name="myOcc" type="radio" value="Scientist" />Scientist<br />
<input class="validate[required] radio" id="RadOther" name="myOcc" type="radio" value="Other" />Other:
<input id="txtOth" class="text-input" name="txtOth" size="35" type="text" value="" /><br />
</td>
</tr>
<tr>
<td class="FormSectionHeader"><br />
Select sessions you are interested in attending: (Check all that apply)</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows">
<input id="S1" name="S1" type="checkBox" value="Yes" />S1 Biodiversity and Genetic Resources<br />
<input id="S2" name="S2" type="checkBox" value="Yes" />S2 Climate and Social Changes Impacting Cassava<br />
<input id="S3" name="S3" type="checkBox" value="Yes" />S3 Genomics and Gene Discovery Platforms<br />
<input id="S4" name="S4" type="checkBox" value="Yes" />S4 Agronomy (Cassava Field Production)<br />
<input id="S5" name="S5" type="checkBox" value="Yes" />S5 CBSD and CMD and CBB<br />
<input id="S6" name="S6" type="checkBox" value="Yes" />S6 Enabling Transgenic and In vitro Technologies (includes haploids)<br />
<input id="S7" name="S7" type="checkBox" value="Yes" />S7 Physiology and Abiotic stress (includes PPD)<br />
<input id="S8" name="S8" type="checkBox" value="Yes" />S8 Modern Breeding (includes MAS, heterosis, transgenics)<br />
<input id="S9" name="S9" type="checkBox" value="Yes" />S9 Field Breeding<br />
<input id="S10" name="S10" type="checkBox" value="Yes" />S10 Metabolic Engineering (includes starch, biofuels, nutritional enhancement)<br />
<input id="S11" name="S11" type="checkBox" value="Yes" />S11 Cassava Delivery Chain<br />
<input id="S12" name="S12" type="checkBox" value="Yes" />S12 Cassava Value Chain<br />
<input id="S13" name="S13" type="checkBox" value="Yes" />S13 Cassava Genomics Workshop<br />
<br />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<input id="chkPremiss" name="chkPremiss" type="checkbox" value="Yes" />
I give permission to have my name, photos, abstract and presentation on the GCP21 website and in the conference proceedings.<br />
</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionHeader">Generation Challenge Program IBP Satellite Meeting, June 23-24, 2012</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows">
<input id="chkSatil" name="chkSatil" type="checkbox" value="Yes" />
I would like to attend<br />
<br />
If you would like to receive more information about the Generation Challenge Program IBP Satellite Meeting, <a href="/GCP21-II/satellite.asp">click here</a><br />
</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionHeader"><strong>Guests</strong>
</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows">Number of guests I plan
on bringing:
<input id="txtRegGues" class="text-input" name="txtRegGues" size="3" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionHeader"><strong>Hotel Information</strong></td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows">
<input id="chkSecDep" class="validate[required]" name="chkSecDep" type="checkbox" value="Yes" />
I agree to provide the hotel with either my credit card
or US $50 upon arrival as security deposit against
any incidentals (such as phone calls, mini bar, movies,
laundry and extra meals) in addition to the room charge.</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td><br />
<input name="Next" type="submit" value="Next" /></td>
</tr>
</table>
</form>
</div>
</div>
<small>This page updated 2/7/2012</small>
</td>
<td align="left" valign="top" width="180">
<div class="container_content_right">
<br />
<!--#include virtual ="/sidebars/sidebar-science.asp"--></div>
</td>
</tr>
</table>
<!--#include virtual ="/footer.asp"--></center>
</body>
</html>
<% end if %>
Hey this is really a lot of code to go through. I am going to post updated code with my notes below. If you have problems going forward, lets just post a shortened version to keep it simple.
You will see my updates in your code with ************ A NOTE ***********
1) Delete the END IF at the very bottom and move it just above <html xmlns="http://www.w3.org/1999/xhtml"> Just above that remove the Else
2) After if NOT rs.BOF AND NOT rs.EOF then you should add some code to update your database to save the form info. Then redirect to whatever page goes next, thank you or another form?
3) get rid of <input id="Button1" type="button" value="button" onclick="validateRegType() ;"/>. You are checking for a valid email when the form is submitted
4) move response.write errormessage towards the top of your form
You will see my updates in your code with ************ A NOTE ***********
1) Delete the END IF at the very bottom and move it just above <html xmlns="http://www.w3.org/1999/xhtml"> Just above that remove the Else
2) After if NOT rs.BOF AND NOT rs.EOF then you should add some code to update your database to save the form info. Then redirect to whatever page goes next, thank you or another form?
3) get rid of <input id="Button1" type="button" value="button" onclick="validateRegType()
4) move response.write errormessage towards the top of your form
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Language=VBscript Codepage="65001" %>
<% Response.Expires=0 %>
<!-- #include file="ASPConnection.inc" -->
<% if request.form("txtEmail")<>"" then %>
<%
'------------------------------------------------------------------------------------------
' Declare vars
'------------------------------------------------------------------------------------------
sEmailLookup = request.form("txtEmail")
'------------------------------------------------------------------------------------------
' DB work
'------------------------------------------------------------------------------------------
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "Provider=sqloledb;" & _
"Data Source=SQL01;" & _
"Initial Catalog=***;" & _
"User Id=***;" & _
"Password=***"
Set rs = Server.CreateObject("ADODB.Recordset")
sSQL = "SELECT UID FROM RegTypeFilter WHERE UID = " & "'" & sEmailLookup & "'"
rs.Open sSQL, oConn
errormessage=""
if NOT rs.BOF AND NOT rs.EOF then
' ******************* ADD *************************
' **** UPDATE DATABASE HERE ***********
' **** Then redirect to NEXT PAGE or whatever the "Next" button is supposed to do ***********
response.write ("MATCH FOUND") '
else
response.write ("MATCH NOT FOUND")
errormessage = "You are not authorized to select that registration type"
end if
'aTableValues = rs.GetRows()
'Dim iRowLoop, iColLoop
'For iRowLoop = 0 to UBound(aTableValues, 2)
' For iColLoop = 0 to UBound(aTableValues, 1)
' Response.Write(aTableValues(iColLoop, iRowLoop) & "<br>")
' Next 'iColLoop
' Response.Write("<p>")
'Next 'iRowLoop
'Call ConvertToJSArray2D(aTableValues,"arrUserInfo2D")
%>
<%' ******* REMOVE else %>
<%end if ' ******added %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="IE=7" http-equiv="X-UA-Compatible" />
<title>The Donald Danforth Plant Science Center</title>
<!--Script links-->
<script src="../../../../../../../../scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<script src="scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="scripts/jquery.infieldlabel.min.js" type="text/javascript"></script>
<script src="scripts/jquery.infieldlabel.js" type="text/javascript"></script>
<script src="scripts/jquery.validationEngine-en.js" type="text/javascript"></script>
<script src="scripts/jquery.validationEngine.js" type="text/javascript"></script>
<script src="scripts/jquery.limit-1.2.source.js" type="text/javascript"></script>
<!--CSS links-->
<link href="../../../../../../../../css/ddpsc_global.css" rel="stylesheet" type="text/css" />
<link href="../../../../../../../../css/ddpsc_home.css" rel="stylesheet" type="text/css" />
<link href="css/layout.css" rel="stylesheet" type="text/css" />
<link href="css/reset.css" rel="stylesheet" type="text/css" />
<link href="css/validationEngine.jquery.css" rel="stylesheet" type="text/css" />
<!--Embedded CSS-->
<style type="text/css">
form td {
position: relative;
}
label {
position: absolute;
}
div.centered table {
margin: 0 auto;
text-align: left;
}
#wrapper {
width: 515px;
margin: 0 auto;
}
#inputArea {
font-family: Arial, Sans-Serif;
font-size: 10pt;
background-color: #DDDDDD;
padding: 15px;
}
.FormSectionHeader {
border-bottom: #000000 thin solid;
font-family: Arial, Helvetica, sans-serif;
color: black;
font-size: 10pt;
font-weight: bold;
}
.FormSectionRows {
font-family: Arial, Helvetica, sans-serif;
color: black;
height: 35px;
}
.FormSectionHeaderSpacer {
font-family: Arial, Helvetica, sans-serif;
height: 13px;
}
.FormSectionDonationInfoRow {
font-family: Arial, Helvetica, sans-serif;
color: black;
font-size: 10pt;
font-weight: bold;
}
.HiddenDiv {
display: none;
}
.DisplayDiv {
display: inherit;
}
.auto-style2 {
color: #000000;
}
.auto-style4 {
font-size: small;
}
#myTrap {
display: none;
}
</style>
<script type="text/javascript">
function validateRegType()
{
// var theList = arrUserInfo2D;
var PayHow = '';
var frm = document.DonateForm;
for (var index = 0; index < frm.PayHow.length; index++ )
if( frm.PayHow[ index ].checked )
PayHow = frm.PayHow[ index ].value
if (PayHow=="InvSpeaker" || PayHow=="ConfOrg")
{
alert("You are not authorized to select that registration type.");
return false;
}
}
</script>
</head>
<body>
<center>
<!--#include virtual ="/header.asp"-->
<table cellpadding="0" cellspacing="0" width="900">
<tr>
<td height="100" width="900">
<img border="0" src="../GCP21-II/images/banner_GCP21.jpg" width="900" />
</td>
</tr>
</table>
<br />
<%
' ************* REMOVE <input id="Button1" type="button" value="button" onclick="validateRegType();"/>
%>
<%
response.write errormessage 'this will only show up if the form was submitted and they were not in the database
%>
<table background-color="fff" border="0" cellpadding="0" cellspacing="0" class="container_content_nobackground" width="900">
<tr>
<td align="left" valign="top" width="180"><br />
<br />
<!--#include virtual ="/menus/menu_GCP21.asp"--></td>
<td align="left" valign="top" width="650">
<script src="../../../../../../../../scripts/breadcrumbs.js" type="text/javascript"></script>
<!-- begin content area -->
<div id="wrapper">
<div id="inputArea">
<form id="DonateForm" name="DonateForm" action="" class="formular" method="post">
<%
response.write errormessage ' *************** ADDED ************
%>
<textarea id="myTrap" cols="1" name="myTrap" rows="1"></textarea>
<table style="width: 100%;">
<tr>
<td class="FormSectionHeader">Select Registration Type* <font color="#CC0000"><strong>(REQUIRED TO CONTINUE)</strong></font></td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows">
<input class="validate[required] radio" id="Rad1" name="PayHow" type="radio" value="Registrant" />Standard Registrant ($350.00 USD. Payment required upon registration)<br />
<input class="validate[required] radio" id="Rad2" name="PayHow" type="radio" value="InvSpeaker" />Invited Speaker<br />
<input class="validate[required] radio" id="Rad3" name="PayHow" type="radio" value="TravelGrant" />Travel Grant (You must register first on this page and complete the next page before leaving the website or your Travel Grant application will not be valid. You will submit your abstract in the "Post-Registration" section later when it is ready)<br />
<input class="validate[required] radio" id="Rad4" name="PayHow" type="radio" value="ConfOrg" />Conference Organizer </td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionHeader">Contact Information*</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtFName"> First
Name*</label><input id="txtFName" class="validate[required] text-input" name="txtFName" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtMName"> Middle
Name</label><input id="txtMName" name="txtMName" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtLName"> Last
Name*</label><input id="txtLName" class="validate[required] text-input" name="txtLName" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtEmail"> Email
Address*</label><input id="txtEmail" class="validate[required,custom[email]] text-input" name="txtEmail" size="35" type="text" value="" /></td>
<br />
<br />
</tr>
<tr>
<td class="FormSectionRows">
<input class="bigcheck" name="optSex" type="radio" value="Female" />Female
<input class="bigcheck" name="optSex" type="radio" value="Male" />Male</td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtNat"> Nationality</label><input id="txtNat" name="txtNat" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows"><label for="txtSOrg"> Institute/Organization</label><input id="txtSOrg" name="txtSOrg" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows"><label for="bill_add"> Address*</label><input id="bill_add" class="validate[required] text-input" name="bill_add" size="50" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtBill_City"> City*</label><input id="txtBill_City" class="validate[required] text-input" name="txtBill_City" size="20" type="text" value="" />
<select id="cboBill_State" class="validate[required]" name="cboBill_State">
<option value="">State*</option>
<option value="NUS">Non US</option>
<option value="AL">AL</option>
<option value="AK">AK</option>
<option value="AZ">AZ</option>
<option value="AR">AR</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DE">DE</option>
<option value="DC">DC</option>
<option value="FL">FL</option>
<option value="GA">GA</option>
<option value="HI">HI</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="IA">IA</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="ME">ME</option>
<option value="MD">MD</option>
<option value="MA">MA</option>
<option value="MI">MI</option>
<option value="MN">MN</option>
<option value="MS">MS</option>
<option value="MO">MO</option>
<option value="MT">MT</option>
<option value="NE">NE</option>
<option value="NV">NV</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>
<option value="NY">NY</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PA">PA</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VT">VT</option>
<option value="VA">VA</option>
<option value="WA">WA</option>
<option value="WV">WV</option>
<option value="WI">WI</option>
<option value="WY">WY</option>
</select> <label for="bBill_zip"> Zip</label><input id="bBill_zip" class="validate[minSize[5]] text-input" name="bBill_zip" size="6" style="width: 44px" type="text" value="" />
<br />
* Non-US citizens - please select non-US option in the state drop down<br />
<br />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtBill_Con"> Country*</label><input id="txtBill_Con" class="validate[required] text-input" name="txtBill_Con" size="50" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="night_phone_a">Phone*</label><input id="night_phone_a" class="validate[required,minSize[3]] text-input" name="night_phone_a" size="3" type="text" value="" /> - <label for="night_phone_b"></label><input id="night_phone_b" class="validate[required,minSize[3]] text-input" name="night_phone_b" size="3" type="text" value="" /> - <label for="night_phone_c"></label><input id="night_phone_c" class="validate[required,minSize[4]] text-input" name="night_phone_c" size="3" type="text" value="" /> <input class="bigcheck" name="optPhoneType" type="radio" value="Home" />Home <input class="bigcheck" name="optPhoneType" type="radio" value="Business" />Business <input class="bigcheck" name="optPhoneType" type="radio" value="Cell" />Cell</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="fax_phone_a">Fax</label><input id="fax_phone_a" name="fax_phone_a" size="3" type="text" value="" /> -
<label for="fax_phone_b"></label>
<input id="fax_phone_b" name="fax_phone_b" size="3" type="text" value="" /> -
<label for="fax_phone_c"></label>
<input id="fax_phone_c" name="fax_phone_c" size="3" type="text" value="" />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<input id="ParticList" name="ParticList" type="checkbox" value="Yes, exclude from list" />
Please click here if you want to be EXCLUDED from participant list</td>
</tr>
<tr>
<td class="FormSectionHeader">Password* <font color="#CC0000"><strong>(REQUIRED)</strong></font></td>
</tr>
<tr>
<td class="FormSectionRows"><br />
Post-Registration Information:<br />
You will need a password to enter the Post-Registration
portal where you will load<br />
your abstract, register your guests and enter your arrival/departure
information for yourself and your guests.<br />
<br />
<label for="txtPswrd"> Password*</label><input id="txtPswrd" class="validate[required] text-input" name="txtPswrd" size="35" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionHeader">Persons to Contact in
Case of an Emergency*</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtEmerCont"> Name*</label><input id="txtEmerCont" class="validate[required] text-input" name="txtEmerCont" size="35" type="text" value="" />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="emer_phone_a">Phone*</label><input id="emer_phone_a" class="validate[required,minSize[3]] text-input" name="emer_phone_a" size="3" type="text" value="" /> - <label for="emer_phone_b"></label><input id="emer_phone_b" class="validate[required,minSize[3]] text-input" name="emer_phone_b" size="3" type="text" value="" /> - <label for="emer_phone_c"></label><input id="emer_phone_c" class="validate[required,minSize[4]] text-input" name="emer_phone_c" size="3" type="text" value="" /> <input class="bigcheck" name="optEmerPhoneType" type="radio" value="Home" />Home <input class="bigcheck" name="optEmerPhoneType" type="radio" value="Business" />Business <input class="bigcheck" name="optEmerPhoneType" type="radio" value="Cell" />Cell
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtEmerCoun"> Country*</label><input id="txtEmerCoun" class="validate[required] text-input" name="txtEmerCoun" size="35" type="text" value="" />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtEmerCont2"> Name*</label><input id="txtEmerCont2" class="validate[required] text-input" name="txtEmerCont2" size="35" type="text" value="" />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="emer_phone_a2">Phone*</label><input id="emer_phone_a2" class="validate[required,minSize[3]] text-input" name="emer_phone_a2" size="3" type="text" value="" /> - <label for="emer_phone_b2"></label><input id="emer_phone_b2" class="validate[required,minSize[3]] text-input" name="emer_phone_b2" size="3" type="text" value="" /> - <label for="emer_phone_c2"></label><input id="emer_phone_c2" class="validate[required,minSize[4]] text-input" name="emer_phone_c2" size="3" type="text" value="" /> <input class="bigcheck" name="optEmerPhoneType2" type="radio" value="Home" />Home <input class="bigcheck" name="optEmerPhoneType2" type="radio" value="Business" />Business <input class="bigcheck" name="optEmerPhoneType2" type="radio" value="Cell" />Cell
</td>
</tr>
<tr>
<td class="FormSectionRows">
<label for="txtEmerCoun2"> Country*</label><input id="txtEmerCoun2" class="validate[required] text-input" name="txtEmerCoun2" size="35" type="text" value="" />
</td>
</tr>
<tr>
<td class="FormSectionHeader">Additional Information</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows">Special Needs Including Dietary Requests:<br />
<br />
<textarea id="txtSpecNeeds" name="txtSpecNeeds" rows="3" cols="50"></textarea><br />
<span id="charsLeft"></span> characters left.
<script type="text/javascript">
$('#txtSpecNeeds').limit('3000', '#charsLeft');
</script>
</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionHeader"><strong>My Occupation*</strong></td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows">
<input class="validate[required] radio" id="RadStud" name="myOcc" type="radio" value="Student" />Student<br />
<input class="validate[required] radio" id="RadTech" name="myOcc" type="radio" value="Tech" />Technician<br />
<input class="validate[required] radio" id="RadYoung" name="myOcc" type="radio" value="YoungScientist" />Young Scientist<br />
<input class="validate[required] radio" id="RadSci" name="myOcc" type="radio" value="Scientist" />Scientist<br />
<input class="validate[required] radio" id="RadOther" name="myOcc" type="radio" value="Other" />Other:
<input id="txtOth" class="text-input" name="txtOth" size="35" type="text" value="" /><br />
</td>
</tr>
<tr>
<td class="FormSectionHeader"><br />
Select sessions you are interested in attending: (Check all that apply)</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows">
<input id="S1" name="S1" type="checkBox" value="Yes" />S1 Biodiversity and Genetic Resources<br />
<input id="S2" name="S2" type="checkBox" value="Yes" />S2 Climate and Social Changes Impacting Cassava<br />
<input id="S3" name="S3" type="checkBox" value="Yes" />S3 Genomics and Gene Discovery Platforms<br />
<input id="S4" name="S4" type="checkBox" value="Yes" />S4 Agronomy (Cassava Field Production)<br />
<input id="S5" name="S5" type="checkBox" value="Yes" />S5 CBSD and CMD and CBB<br />
<input id="S6" name="S6" type="checkBox" value="Yes" />S6 Enabling Transgenic and In vitro Technologies (includes haploids)<br />
<input id="S7" name="S7" type="checkBox" value="Yes" />S7 Physiology and Abiotic stress (includes PPD)<br />
<input id="S8" name="S8" type="checkBox" value="Yes" />S8 Modern Breeding (includes MAS, heterosis, transgenics)<br />
<input id="S9" name="S9" type="checkBox" value="Yes" />S9 Field Breeding<br />
<input id="S10" name="S10" type="checkBox" value="Yes" />S10 Metabolic Engineering (includes starch, biofuels, nutritional enhancement)<br />
<input id="S11" name="S11" type="checkBox" value="Yes" />S11 Cassava Delivery Chain<br />
<input id="S12" name="S12" type="checkBox" value="Yes" />S12 Cassava Value Chain<br />
<input id="S13" name="S13" type="checkBox" value="Yes" />S13 Cassava Genomics Workshop<br />
<br />
</td>
</tr>
<tr>
<td class="FormSectionRows">
<input id="chkPremiss" name="chkPremiss" type="checkbox" value="Yes" />
I give permission to have my name, photos, abstract and presentation on the GCP21 website and in the conference proceedings.<br />
</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionHeader">Generation Challenge Program IBP Satellite Meeting, June 23-24, 2012</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows">
<input id="chkSatil" name="chkSatil" type="checkbox" value="Yes" />
I would like to attend<br />
<br />
If you would like to receive more information about the Generation Challenge Program IBP Satellite Meeting, <a href="/GCP21-II/satellite.asp">click here</a><br />
</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionHeader"><strong>Guests</strong>
</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows">Number of guests I plan
on bringing:
<input id="txtRegGues" class="text-input" name="txtRegGues" size="3" type="text" value="" /></td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionHeader"><strong>Hotel Information</strong></td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td class="FormSectionRows">
<input id="chkSecDep" class="validate[required]" name="chkSecDep" type="checkbox" value="Yes" />
I agree to provide the hotel with either my credit card
or US $50 upon arrival as security deposit against
any incidentals (such as phone calls, mini bar, movies,
laundry and extra meals) in addition to the room charge.</td>
</tr>
<tr>
<td class="FormSectionHeaderSpacer"> </td>
</tr>
<tr>
<td><br />
<input name="Next" type="submit" value="Next" /></td>
</tr>
</table>
</form>
</div>
</div>
<small>This page updated 2/7/2012</small>
</td>
<td align="left" valign="top" width="180">
<div class="container_content_right">
<br />
<!--#include virtual ="/sidebars/sidebar-science.asp"--></div>
</td>
</tr>
</table>
<!--#include virtual ="/footer.asp"--></center>
</body>
</html>
<%
' *************************REMOVE ******<% end if % >
%>
ASKER
Ok, I see now. But now when I submit the completed form and the email address I keyed does not match the criteria for the query, it shows the error properly but all of the form data has been lost? This is a massive form to have to fill out more than once because they selected an unauthorized radio selection.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Language=VBscript Codepage="65001" %>
<% Response.Expires=0 %>
<% if request.form("txtEmail")<>"" then %>
<%
function FixQuote(strfix)
position = instr(strfix,"'")
do while position > 0
strfix = mid(strfix,1, position) & mid(strfix,position)
position = instr(position + 2, strfix,"'")
loop
FixQuote = strfix
end function
'------------------------------------------------------------------------------------------
' Declare vars
'------------------------------------------------------------------------------------------
sEmailLookup = request.form("txtEmail")
datRegDate = Now()
sPayHow = Request("PayHow")
sFirstName = fixquote(Request("txtFName"))
Session("sFirstName") = sFirstName
sMidName = fixquote(Request("txtMName"))
sLastName = fixquote(Request("txtLName"))
Session("sLastName") = sLastName
sFullName = sFirstName & " " & sMidName & " " & sLastName
Session("sFullName") = sFullName
sEmail = Request("txtEmail")
sIsPaid = ""
Session("isSpam") = Request("myTrap")
'------------------------------------------------------------------------------------------
' DB work
'------------------------------------------------------------------------------------------
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "Provider=sqloledb;" & _
"Data Source=SQL01;" & _
"Initial Catalog=***;" & _
"User Id=***;" & _
"Password=***"
Set rs = Server.CreateObject("ADODB.Recordset")
sSQL = "SELECT UID FROM RegTypeFilter WHERE UID = " & "'" & sEmailLookup & "'"
rs.Open sSQL, oConn
errormessage=""
if NOT rs.BOF AND NOT rs.EOF then
response.write ("MATCH FOUND")
if Session("isSpam") = "" AND sFirstName <> "" then
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "Provider=sqloledb;" & _
"Data Source=SQL01;" & _
"Initial Catalog=***;" & _
"User Id=***;" & _
"Password=***"
sSQL = "INSERT INTO Registration VALUES('" & datRegDate & "','" & sPayHow & "','" & sIsPaid & "','" & sFirstName & "','" & sMidName & "','" & sLastName & "','" & sEmail & "','" & sGender & "','" & sNation & "','" & sOrg & "','" & sBillAddr & "','" & sBillCity & "','" & sBillState & "','" & sBillZip & "','" & sBillCont & "','" & sPhoneA & "','" & sPhoneB & "','" & sPhoneC & "','" & sPhoneType & "','" & sFaxA & "','" & sFaxB & "','" & sFaxC & "','" & bParticList & "','" & sPassword & "','" & sEmergContact & "','" & sEmergPhoneA & "','" & sEmergPhoneB & "','" & sEmergPhoneC & "','" & sEmergPhoneType & "','" & sEmergCont & "','" & sAltEmergContact & "','" & sAltEmergPhoneA & "','" & sAltEmergPhoneB & "','" & sAltEmergPhoneC & "','" & sAltEmergPhoneType & "','" & sAltEmergCont & "','" & sSpecNeeds & "','" & bMyOcc & "','" & sTextOth & "','" & bSubAbstract & "','" & bS1 & "','" & bS2 & "','" & bS3 & "','" & bS4 & "','" & bS5 & "','" & bS6 & "','" & bS7 & "','" & bS8 & "','" & bS9 & "','" & bS10 & "','" & bS11 & "','" & bS12 & "','" & bS13 & "','" & bchkPermiss & "','" & bSatellite & "','" & sGuests & "','" & bchkSecDep & "')"
'response.write sSQL
set rs = oConn.Execute(sSQL)
else
end if
'direct user to next screen based on type
if sPayHow = "Registrant" then
response.Redirect ("GCP21Payments.asp")
elseif sPayHow = "InvSpeaker" then
response.Redirect ("GCP21Thankyou.asp")
elseif sPayHow = "TravelGrant" then
response.Redirect ("GCP21TravelGrant.asp")
elseif sPayHow = "ConfOrg" then
response.Redirect ("GCP21Thankyou.asp")
end if
else
response.write ("MATCH NOT FOUND")
errormessage = "<font color = 'red'><strong>*You are not authorized to select that registration type.<br />Please select another.</strong></font>"
end if
'aTableValues = rs.GetRows()
'Dim iRowLoop, iColLoop
'For iRowLoop = 0 to UBound(aTableValues, 2)
' For iColLoop = 0 to UBound(aTableValues, 1)
' Response.Write(aTableValues(iColLoop, iRowLoop) & "<br>")
' Next 'iColLoop
' Response.Write("<p>")
'Next 'iRowLoop
'Call ConvertToJSArray2D(aTableValues,"arrUserInfo2D")
%>
<% end if %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
ASKER
Do I need to add values to all of the form elements like so?
value="<%=sFirstName%>"
value="<%=sFirstName%>"
In your code where you have
<%
'------------------------- ---------- ---------- ---------- ---------- ---------- ---------- -----
' Declare vars
'------------------------- ---------- ---------- ---------- ---------- ---------- ---------- -----
sEmailLookup = request.form("txtEmail")
%>
add the following
<%
'------------------------- ---------- ---------- ---------- ---------- ---------- ---------- -----
' Declare vars
'------------------------- ---------- ---------- ---------- ---------- ---------- ---------- -----
sEmailLookup = request.form("txtEmail")
txtFName= request.form("txtFName")
' add field names for each form field
%>
Now on your form where you have
<input id="txtFName" class="validate[required] text-input" name="txtFName" size="35" type="text" value="" />
add the value of the field
<input id="txtFName" class="validate[required] text-input" name="txtFName" size="35" type="text" value="<%=txtFName%>" />
Now, when the form is submitted, anything they entered will be saved. If you want to get tricky, you can test for empty fields. If the field is empty color it red.
<input id="txtFName" class="validate[required] text-input <%if txtFName="" then response.write("red")end if%>" name="txtFName" size="35" type="text" value="<%=txtFName%>" />
This adds the class, "red" then in your css add your formatting to the red class.
<%
'-------------------------
' Declare vars
'-------------------------
sEmailLookup = request.form("txtEmail")
%>
add the following
<%
'-------------------------
' Declare vars
'-------------------------
sEmailLookup = request.form("txtEmail")
txtFName= request.form("txtFName")
' add field names for each form field
%>
Now on your form where you have
<input id="txtFName" class="validate[required] text-input" name="txtFName" size="35" type="text" value="" />
add the value of the field
<input id="txtFName" class="validate[required] text-input" name="txtFName" size="35" type="text" value="<%=txtFName%>" />
Now, when the form is submitted, anything they entered will be saved. If you want to get tricky, you can test for empty fields. If the field is empty color it red.
<input id="txtFName" class="validate[required] text-input <%if txtFName="" then response.write("red")end if%>" name="txtFName" size="35" type="text" value="<%=txtFName%>" />
This adds the class, "red" then in your css add your formatting to the red class.
ASKER
Ok, thanks. What can I do to retain values for the radio buttons and checkboxes in this same situation?
Radio buttons are easy because they are either on or off.
for each radio button...
<input name="myOcc" type="radio" class="validate[required] radio" id="RadStud" value="Student" <% if myOcc="Student" then response.write("checked="" checked""" end if%> />
If checkbox's are grouped they are saved as a comma separated field . However, it looks like your checkbox's are all unique. So you would do the same as the radio.
<input name="S1" type="checkBox" id="S1" value="Yes" <% if S1="Yes" then response.write("checked="" checked""" end if%> />
If your checkbox's were grouped (multiple with the same name) you would end up with a field looking like - answer1,answer2,answer3. Then you will use the split function to break out the answers to an array. The first box you would see if array(0) matched. The 2nd array(1) and so on.
for each radio button...
<input name="myOcc" type="radio" class="validate[required] radio" id="RadStud" value="Student" <% if myOcc="Student" then response.write("checked=""
If checkbox's are grouped they are saved as a comma separated field . However, it looks like your checkbox's are all unique. So you would do the same as the radio.
<input name="S1" type="checkBox" id="S1" value="Yes" <% if S1="Yes" then response.write("checked=""
If your checkbox's were grouped (multiple with the same name) you would end up with a field looking like - answer1,answer2,answer3. Then you will use the split function to break out the answers to an array. The first box you would see if array(0) matched. The 2nd array(1) and so on.
ASKER
Thank you for your patient help today. I learned a lot.
ASKER