Link to home
Start Free TrialLog in
Avatar of slegy
slegy

asked on

Dreamweaver Form Connected to Access Database

I have a form developed in Dreamweaver CS3 that collects event information and stores it in a database. I've been redoing my testing and trying to incorporate reCaptcha and uncovered an oddity that I can't solve.

The first field on the form is a classification field. Selection is made from a drop-down menu of values from the database. It works fine if a value is selected. However, if, when it does through a Javascript edit, a field was not selected, an alert message is displayed informing the user that a selection is required. Then the error occurs:
ADODB.Command error '800a0d5d'

Application uses a value of the wrong type for the current operation.

/racing/calendar/eventAdd.asp, line 35
Line 35:
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 30, Request.Form("classification")) ' adVarWChar

Validation code:

    if (document.getElementById('classification').selectedIndex == "0")
        {
         alert("Event Classification is Required");
         return false;
        }

Classification contains six entries: Select a Classification, Area, District, Other, Worlds (all character fields). What am I missing?
Avatar of Rouchie
Rouchie
Flag of United Kingdom of Great Britain and Northern Ireland image

Relying on Javascript alone for form validation is dangerous, because people can just disable it then post corrupt data from your form.  This is where DW fails to be adequate enough to protect your web application.

What you need to do is perform an extra check on the server-side after the form is submitted.

So, before ANY database activity takes place, put in these checks:


<%
Dim errorText ' declare an empty variable to hold error data
errorText = ""
 
' check classification'
IF Request.Form("classification") = "" Then ' if errors occurred then fill in error variable
   errorText = errorText & "<p>Error: Classification cannot be blank!</p>"
End If
' check another form field if needed (just repeat this logic for all fields)'
If Request.Form("nextFormFieldToCheck"))
   errorText = errorText & "<p>Error: FieldABC cannot be blank!</p>"
End If
 
' only perform database actions if no errors occurred, otherwise show error:
IF errorText <> "" Then
    %>
    <h3>Errors occurred!</h3>
    <%=errorText%>
    <p>Please press BACK and try again!</p>
    <%
Else
    ' NORMAL DREAMWEAVER DATABASE CODE GOES HERE!!!
End If
%>

Open in new window

Avatar of slegy
slegy

ASKER

There are two things I'm trying to accomplish with this form and a related update form - find a solution for the error AND incorporate a reCaptcha test. I discovered the above-described error while trying to add reCaptcha code. Here's the recaptcha code:
<%
function recaptcha_confirm(privkey,rechallenge,reresponse)
  ' Test the captcha field
  Dim VarString
  VarString = _
  "privatekey=" & privkey & _
  "&remoteip=" & Request.ServerVariables("REMOTE_ADDR") & _
  "&challenge=" & rechallenge & _
  "&response=" & reresponse
  Dim objXmlHttp
  Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
  objXmlHttp.open "POST", "http://api-verify.recaptcha.net/verify", False
  objXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  objXmlHttp.send VarString
  Dim ResponseString
  ResponseString = split(objXmlHttp.responseText, vblf)
  Set objXmlHttp = Nothing
  if ResponseString(0) = "true" then
    ' They answered correctly
    recaptcha_confirm = "" 
  else
    ' They answered incorrectly
    recaptcha_confirm = ResponseString(1)
  end if
end function
%>
It also needs to go before any of the normal Dreamweaver database code. I've tried putting it various places with no success.

Here's the form definition:
<form action="<%=MM_editAction%>" method="POST" name="eventAdd">

Here's the beginning of the Dreamweaver code for the database update:

<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
  If condition = "" Then
    MM_IIf = ifFalse
  Else
    MM_IIf = ifTrue
  End If
End Function
%>
<%
If (CStr(Request("MM_insert")) = "eventAdd") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd
    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_eventCalendar_STRING
    MM_editCmd.CommandText = "INSERT INTO eventCalendar (classification, eventTitle, [eventTitle-long], startMonth, startDay, startYear, endMonth, endDay, endYear, [host], district, fleet, city, stateProvince, country, contact, eddress, phone, eddress2, website, comments) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 30, Request.Form("classification")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 42, Request.Form("eventTitle")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 100, Request.Form("eventTitle-long")) ' adVarWChar. . .

I've tried inserting it in the above code before the actual update, but it doesn't appear to execute. Where specifically do I put this code and the code you provided for the field validation? I've also tried calling the VB from the JavaScript, but that hasn't worked either.

Avatar of slegy

ASKER

I should have added, I'd still like to understand why the error is occurring.The field is correctly recognized as a character field, length 30. The error is occurring on all required fields, which are all character. Where is value of the wrong type coming from?
Okay 2 problems initially before we get to the captcha part.

The first is that your database is expecting a 30-character entry for classification.  Your default entry however in the form is this (shown in quotes with underscores representing spaces to illustrate my next point):

  "_Select_an_Event_Classification"

If you count the characters there - there are 31!  So you get an immediate error because too many characters are being submitted.

However, the form should never even be submitted here because your Javascript is supposed to prevent this happening and force the user to make a choice.  The JavaScrit does the checks but for some reason the form still submits, which is really bizarre.  Did DW generate this code for you, and have you modified it since creation?
Avatar of slegy

ASKER

You are right, there are 31. I just checked and the database is set up for 60. Not sure why it is set to 30 in the code. But none of the valid entries is close to 31. So you believe the form is actually submitting with the invalid select (index 0) and that is causing the error? That would also explain why I'm getting the same error on missing two-character day and month selections. I've used this same type of Javascript validation code in other forms without a problem, but they do not connect to a database.

I would guess at this point that it would be best to follow your suggestion to put the more effective checks in. Should they totally replace the Javascript? Can they be executed from the onClick event?
Avatar of slegy

ASKER

I just thought about what I wrote. I'm guessing the form should just sumit and the action code should include the field checks. I'll see if I can set up a test doing it that way. Sorry I'm sounding so muddled.
Well, onclick is a javascript trigger, and can only trigger javascript.  Javascript is nice for quick and simple checking, but cannot be relied upon under any circumstances to protect your data.  I have at least 2 browser addons for Firefox that can disable javascript in a click!

The checks need to go server-side as in my original post.  Dreamweaver does not write these checks in server-side languages and relies on Javascript (I believe), so you are going to have to write some code if I am right.

Let's try a really simple test.

Please add this into the  section of the page:

<script type="text/javascript">
        function checkform() {
                if(document.getElementById('classification').value == ""){
                      window.alert('You must select a classification!');
                      return false;
                }
                return true;
          }
</script>

Then remove the value for classification (don't worry, the user will still see the text, but it will be easier for us to validate the value):
    <option value=" Select an Event Classification" selected="selected" > Select an Event Classification</option>

becomes:
    <option value="" selected="selected" >Select an Event Classification</option>


Then on your submit button that currently says this:
    <input name="submit" type="submit" id="submit" onclick="MM_callJS('submitForm()')" value="Submit" />

Change it to say this:
    <input name="submit" type="submit" id="submit" onclick="return checkform();" value="Submit" />

Now the form should not submit without choosing a new value of classification.
Avatar of slegy

ASKER

Sorry, I got sidetracked with trying to set up subwebs and permissions. Am working on this today. Thank you so much for your input.
Avatar of slegy

ASKER

For some reason, this did not post yesterday. The classification list comes from the database, so the code is generated by Dreamweaver:

          <label for="classification">Classification:<span class="smallRed">*</span></label>
          <select name="classification" size="1" id="classification">
            <%
While (NOT rseventClass.EOF)
%>
            <option value="<%=(rseventClass.Fields.Item("eventClass").Value)%>" <%If (Not isNull(" Select an Event Classification")) Then If (CStr(rseventClass.Fields.Item("eventClass").Value) = CStr(" Select an Event Classification")) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rseventClass.Fields.Item("eventClass").Value)%></option>
            <%
  rseventClass.MoveNext()
Wend
If (rseventClass.CursorType > 0) Then
  rseventClass.MoveFirst
Else
  rseventClass.Requery
End If
%>
Can you upload your page to the link you posted originally, so I can see what ASP is writing as HTML?
Can you make a copy of the Add page and use the code I pasted earlier.  Currently the Add page contains the original code.
ACtually, before that try this simple change.

Change:

   <form action="/racing/calendar/eventAdd.asp" method="POST" name="eventAdd">


to this:

   <form action="/racing/calendar/eventAdd.asp" method="POST" name="eventAdd" id="eventAdd">

Then try the Add form and see if it posts when no classification is selected
Avatar of slegy

ASKER

Sorry my response has been slow. I've been busy updating over 900 pages in order t get HTTP --> HTTPS --> HTTP working. Finally finished yesterday. Will be getting back to this later today. Thank you for the suggestion. Will try it first thing.
Avatar of slegy

ASKER

I updated a test page on a test site:  
http://cherryle.win.aplus.net/racing/calendar/eventtestAdd.asp
I get the same error:
ADODB.Command error '800a0d5d'
Application uses a value of the wrong type for the current operation.
/racing/calendar/eventtestAdd.asp, line 48
Line 48:
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 30, Request.Form("classification")) ' adVarWChar
I guess I will try rebuilding the page. It appears that the "Return False" in the JavaScript isn't working. However, if it were simply falling through the code, it would recognize that other required fields were missing. It is as if the Return False is jumping directly to the submit - but that can't be possible.
The javascript is definitely at fault here.

Instead of rebuilding the page, remove any reference to the javascript that checks the form.  Then add in all the validation checks again using DW.

If you do rebuild the page, then try adding the javascript checks in last after all the page logic has been created.
Avatar of slegy

ASKER

I did quite a lot of experimenting yesterday without many positive results. I've gone back to basics. Am adding the code you recommended to test for valid form entries. There must be a simple answer for this but I couldn't find it on the web.
How do I do this check: IF Request.Form("classification") = "" 
when the field is a dropdown list and I need to determine whether something other than the first entry has been selected (index=0)? Most of the required entries are from dropdown lists.
The good news is that I seem to have found the right place to put the code!
Currently classification in the code looks like this:

    <option value=" Select an Event Classification" selected="selected" > Select an Event Classification</option>

Therefore the VALUE will get posted to the next page, so the ASP would be:

IF Trim(Request.Form("classication")) =  "Select an Event Classification" Then
    %>
    <p>Error: Please select a classification</p>
    <%
Else
    ' save code here .....
End If

Or if you can alter the VALUE of classification so it reads like this (recommended!):

    <option value="" selected="selected" >Select an Event Classification</option>

Then the ASP becomes easier:

IF Trim(Request.Form("classication")) =  "" Then
    %>
    <p>Error: Please select a classification</p>
    <%
Else
    ' save code here .....
End If
Avatar of slegy

ASKER

It just dawned on me that I should just need to check for the value in the first item. Will test that.
Avatar of slegy

ASKER

The error checking you suggested is working almost perfectly. AND, best of all it is not dropping down into the database code. However, the error messages are displaying at the top of the page (pushing the page downward) instead of going to a new page. And, the form gets cleared. Is there a way to preserve all the data that was entered so the user doesn't have to enter again? They will be truly irritated if they have to re-enter everything. Also, this is the same in which page I'm going to have to get some kind of captcha solution implemented. I both cases I'm going to have to preserve what was entered.
Avatar of slegy

ASKER

Just an update...With the apparent need to go to a second page to do captcha validation, I deleted all database update code from the eventAdd page. My current theory is to use eventAdd to take the input and validate that all required fields have been entered. For simplicity, I reinserted the JavaScript validation routine:
<script type="text/javascript" language="javascript">
function submitForm()
{
    if (document.getElementById('classification').selectedIndex > "0")
        {
   return true;
  }
   else
   {
         alert("Event Classification is Required");
        document.eventAdd.classification.focus();
         event.preventDefault();
         }
        . . . . . . . . .
 document.eventAdd.submit();
}
</script>
As you can see I've tried including a return true and also tried event.preventDefault() (as suggested in another EE solution). Neither work. Just as it did when the database update code was present, the form submits. In fact, I event tried removing the document.eventAdd.submit(), and the form submits anyway. I've found several discussions on the web about "return false" not working, but I've yet to find a solution. No matter what I do, the form submits.
I'd go back to the code you recommended, but I'm not sure how to complete the validation and then accomplish the submit.
Right well let's accomplish both parts of the puzzle and scrap javascript altogether.

Make 2 pages.  Page 1 will contain the form as you have it now, but with NO JAVASCRIPT at all.  This page will submit to page 2, which has ASP validation and the database code.

So when the form submits to page 2, ASP will have to perform the checks as per my earlier example.  What I do nowadays is to have something like this (see code snippet).

By forcing the user to press back when an error occurs, you don't have to manually collect and repopulate every form field, which adds TONS of extra code and makes the whole page harder to work with.

Also you get around the security problem of people turning off javascript and hacking your form values.

Note that you will have to repeat this logic for the update page, by making 2 different pages, but the principle is the same and you should be able to copy and paste all but the SQL command for the update.
<body>
<%
Dim errorText
errorText = ""
 
IF Trim(Request.Form("classication")) =  "" Then
    errorText = errorText & "<li>Classification cannot be blank!</li>" ' create a list item with each error
End If
 
' perform all other checks here using the exact same code.
 
' If any errors have occurred then errorText will have a value, otherwise errorText will be blank
IF errorText <> "" Then
   %>
   <h1 style="font-weight:bold; color:red;">Error!</h1>
   <p>The following errors occurred.   Please press back in your browser and try again.</p>
   <ul style="font-weight:bold; color:red;">
   <%= errorText %>
   </ul>
   <%
Else
   ' save code goes here
   %>
   <p>The record was created successfully.</p>
End If
%>

Open in new window

Avatar of slegy

ASKER

I thought I had it but lost it somewhere. Error checking works great! The method also works perfectly for the Captcha check.
However, the database update isn't working. Even though the Dreamweaver code uses Request.Form, it appears to want the form resident. I created a form with hidden fields, and it seems happy with that, but the database isn't being updated. Related to a Captcha question, someone suggested using:
<body onLoad="document.eventValidate.submit()">
Do you have any suggestions? Also, it appears, though I am not certain, that the textarea which uses TinyMCE doesn't transfer.
Pages:
http://cherryle.win.aplus.net/racing/calendar/eventtestAdd.asp
http://cherryle.win.aplus.net/racing/calendar/eventValidate.asp
 

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../../Connections/eventCalendar.asp" -->
<!--#include file="adovbs.asp"-->
<!--#include file="iasutil.asp"-->
<%
' On Error Resume Next
 
' Classsic ASP pages created by Andre F Bruton
' E-mail: andre@bruton.co.za
' Date: 2008/01/19
 
classification             = SQLEncode(Request("classification"))
eventTitle                 = SQLEncode(Request("eventTitle"))
eventTitle2                = SQLEncode(Request("eventTitle2"))
startMonth                 = SQLEncode(Request("startMonth"))
startDay                   = SQLEncode(Request("startDay"))
startYear                  = SQLEncode(Request("startYear"))
endMonth                   = SQLEncode(Request("endMonth"))
endDay                     = SQLEncode(Request("endDay"))
endYear                    = SQLEncode(Request("endYear"))
host                       = SQLEncode(Request("host"))
district                   = SQLEncode(Request("district"))
fleet                      = SQLEncode(Request("fleet"))
city                       = SQLEncode(Request("city"))
stateProvince              = SQLEncode(Request("stateProvince"))
country                    = SQLEncode(Request("country"))
contact                    = SQLEncode(Request("contact"))
eddress                    = SQLEncode(Request("eddress"))
phone                      = SQLEncode(Request("phone"))
eddress2                   = SQLEncode(Request("eddress2"))
website                    = SQLEncode(Request("website"))
comments                   = SQLEncode(Request("comments"))
recaptcha_challenge_field  = Request("recaptcha_challenge_field")
recaptcha_response_field   = Request("recaptcha_response_field")
recaptcha_private_key      = "6LewIAUAAAAAAAjmgc9mSer6yjKmhN8Y0TageoGt"
recaptcha_public_key       = "6LewIAUAAAAAACE74U2jHkO2TEVvUL-64tJvR2g-"
browser                    = Request.ServerVariables("HTTP_USER_AGENT")
ip                         = Request.ServerVariables("REMOTE_HOST")
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- InstanceBegin template="/Templates/mainLayout.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Add an Event to the ILCA Calendar</title>
<!-- TinyMCE -->
<script language="javascript" type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script src="../../SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
<script src="../../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script type="text/javascript">
tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
		// Theme options
		theme_advanced_buttons1 : "save,newdocument,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,insertdate,inserttime,preview,forecolor,backcolor",
		theme_advanced_disable : "save,newdocument,strikethrough,styleselect,formatselect,pastetext,pasteword,blockquote,anchor,cleanup,help,code,insertdate,inserttime,preview,forecolor,backcolor,hr,removeformat,visualaid,sub,sup,charmap,tablecontrols,hr,removeformat,visualaid,sub,sup,charmap,emotions,iespell,media,advhr,print,ltr,rtl,fullscreen,separator",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
 
		// Drop lists for link/image/media/template dialogs
		external_link_list_url : "tinymce/jscripts/tiny_mce/lists/link_list.js",
		external_image_list_url : "tinymce/jscripts/tiny_mce/lists/image_list.js"
	});
</script>
<!-- InstanceEndEditable --><!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<link href="../../assets/favicon.ico" rel="shortcut icon" />
<link href="../../css/mainLayout.css" rel="stylesheet" type="text/css" />
<link href="../../css/navMenu.css" rel="stylesheet" type="text/css" />
<link href="../../css/ilcaStyles.css" rel="stylesheet" type="text/css" />
<link href="../../css/document.css" rel="stylesheet" type="text/css" />
<script src="../../scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<!-- InstanceBeginEditable name="styles" -->
<link href="../../css/eventUpdate.css" rel="stylesheet" type="text/css" />
<link href="../../css/buttons.css" rel="stylesheet" type="text/css" />
<link href="../../SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
<link href="../../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable --><!-- InstanceParam name="setdatetype" type="text" value="" --><!-- InstanceParam name="cleanup" type="text" value="" -->
</head>
<body onLoad="" onUnload="">
<%
Response.Buffer = True
If (Request.ServerVariables("HTTPS") = "on") Then
    Dim xredir__, xqstr__
 
    xredir__ = "http://" & Request.ServerVariables("SERVER_NAME") & _
               Request.ServerVariables("SCRIPT_NAME")
    xqstr__ = Request.ServerVariables("QUERY_STRING")
 
    if xqstr__ <> "" Then xredir__ = xredir__ & "?" & xqstr__
 
    Response.redirect xredir__
End if
%>
<div id="wrapper">
  <div id="header">
    <div id="rotatingGlobe"> <!-- InstanceBeginEditable name="rotatingGlobe" -->
      <!-- InstanceEndEditable --> </div>
    <div id="hdrLink"><a href="../../index.asp"><img src="../../assets/images/mainTemplate/headerImg.png" border="0" /></a></div>
  </div>
  <div id="sidebar">
    <div id="navigation">
      <!-- menu script itself. you should not modify this file -->
      <script type="text/javascript" language="JavaScript" src="../../scripts/navMenu.js"></script>
      <!-- items structure. menu hierarchy and links are stored there -->
      <script type="text/javascript" language="JavaScript" src="../../scripts/navMenu_items.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu_items.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu2_items.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/storeMenu_items.js"></script>
      <!-- files with geometry and styles structures -->
      <script type="text/javascript" language="JavaScript" src="../../scripts/navMenu_tpl.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu_tpl.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu2_tpl.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/storeMenu_tpl.js"></script>
      <script type="text/javascript" language="javascript">
	<!--//
	// Make sure the menu initialization is right above the closing &lt;/body&gt; tag
	// Moving it inside other tags will not affect the position of the menu on
	// the page. If you need this feature please consider Tigra Menu GOLD.
 
	// each menu gets two parameters (see demo files)
	// 1. items structure
	// 2. geometry structure
 
	new menu (MENU_ITEMS, MENU_TPL);
 
	// If you don't see the menu then check JavaScript console of the browser for the error messages
	// "Variable is not defined" error indicates that there's syntax error in that variable's definition
	// or the file with that variable isn't properly linked to the HTML document
	//-->
</script>
    </div>
    <div id="sbar-image1"><img src="../../assets/images/mainTemplate/panAm.jpg" width="116" height="129" /></div>
    <div id="sbar-image2"><a href="../../membership/joinRenew/membershipOptions.asp"><img src="../../assets/images/mainTemplate/joinILCA.png" alt="Join the ILCA" width="113" height="113" border="0" /></a></div>
    <div id="sbar-search"></div>
  </div>
  <div id="background">
    <div id="mainContent"> <!-- InstanceBeginEditable name="mainContent" -->
      <div id = "docHdr">
        <h3>Add an Event to the ILCA Calendar</h3>
      </div>
      <% 
	Dim errorText
	errorText = ""
	If Trim(Request.Form("classification")) = "Select an Event Classification" Then
		errorText = errorText & "<li>Please specify an event classification!</li>"
	End If
	If Request.Form("eventTitle") = "" Then
		errorText = errorText & "<li>Error: Event Title cannot be blank!</li>"
	End If
	If Request.Form("startMonth") = "Month" Then
		errorText = errorText & "<li>Error: Start month must be selected!</li>"
	End If
	If Request.Form("startDay") = "Day" Then
		errorText = errorText & "<li>Error: Start day must be selected!</li>"
	End If
	If Request.Form("endMonth") = "Month" Then
		errorText = errorText & "<li>Error: End month must be selected!</li>"
	End If
	If Request.Form("endDay") = "Day" Then
		errorText = errorText & "<li>Error: End day must be selected!</li>"
	End If
	
	cTemp = recaptcha_confirm(recaptcha_private_key, recaptcha_challenge_field, recaptcha_response_field)
	If cTemp <> "" Then
		errorText = errorText & "<p>Error: An error occured in the reCaptcha wording"
    End If 
	If errorText <> "" Then
   %>
      <h3 style="font-weight:bold; color:red;">
      Error!
      </h1>
      <p>The following errors occurred.   Please press back in your browser and try again.</p>
      <ul style="font-weight:bold; color:red;">
        <%= errorText %>
      </ul>
      <%
	Else
		Dim MM_editAction
		MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
		If (Request.QueryString <> "") Then
		  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
		End If
		
		' boolean to abort record edit
		Dim MM_abortEdit
		MM_abortEdit = false
		%>
			  <%
		' IIf implementation
		Function MM_IIf(condition, ifTrue, ifFalse)
		  If condition = "" Then
			MM_IIf = ifFalse
		  Else
			MM_IIf = ifTrue
		  End If
		End Function
		%>
			  <%
		If (CStr(Request("MM_insert")) = "eventAdd") Then
		  If (Not MM_abortEdit) Then
			' execute the insert
			Dim MM_editCmd
		
			Set MM_editCmd = Server.CreateObject ("ADODB.Command")
			MM_editCmd.ActiveConnection = MM_eventCalendar_STRING
			MM_editCmd.CommandText = "INSERT INTO eventCalendar (classification, eventTitle, [eventTitle-long], startMonth, startDay, startYear, endMonth, endDay, endYear, [host], district, fleet, city, stateProvince, country, contact, eddress, phone, eddress2, website, comments) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" 
			MM_editCmd.Prepared = true
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 30, Request.Form("classification")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 42, Request.Form("eventTitle")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 100, Request.Form("eventTitle2")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 2, Request.Form("startMonth")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202, 1, 2, Request.Form("startDay")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 202, 1, 4, Request.Form("startYear")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 202, 1, 2, Request.Form("endMonth")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 202, 1, 2, Request.Form("endDay")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param9", 202, 1, 4, Request.Form("endYear")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param10", 202, 1, 50, Request.Form("host")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param11", 202, 1, 50, Request.Form("district")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param12", 5, 1, -1, MM_IIF(Request.Form("fleet"), Request.Form("fleet"), null)) ' adDouble
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param13", 202, 1, 28, Request.Form("city")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param14", 202, 1, 30, Request.Form("stateProvince")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param15", 202, 1, 36, Request.Form("country")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param16", 202, 1, 50, Request.Form("contact")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param17", 202, 1, 200, Request.Form("eddress")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param18", 202, 1, 25, Request.Form("phone")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param19", 202, 1, 200, Request.Form("eddress2")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param20", 202, 1, 200, Request.Form("website")) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param21", 203, 1, 1073741823, Request.Form("comments")) ' adLongVarWChar
			MM_editCmd.Execute
			MM_editCmd.ActiveConnection.Close
		
			' append the query string to the redirect URL
			Dim MM_editRedirectUrl
			MM_editRedirectUrl = "eventSelect.asp"
			If (Request.QueryString <> "") Then
			  If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
				MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
			  Else
				MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
			  End If
			End If
			Response.Redirect(MM_editRedirectUrl)
		  End If
		End If
%>
      <form ACTION="<%=MM_editAction%>" METHOD="POST" name="eventAdd" id="eventAdd">
        <input name="classification" type="hidden" id="classification" value="<%=classification%>" size="`8" maxlength="18" />
        <input name="eventTitle" type="hidden" id="eventTitle" value="<%=eventTitle%>" tabindex="1" size="48"  maxlength="42" />
        <input name="eventTitle2" type="hidden" id="eventTitle2" value="<%=eventTitle2%>" tabindex="2" size="65"  maxlength="80" />
        <input name="startMonth" type="hidden" id="startMonth" value="<%=startMonth%>" size="5" maxlength="2" />
        <input name="startDay" type="hidden" id="startDay" value="<%=startDay%>" size="5" maxlength="2" />
        <input name="startYear" type="hidden" id="startYear" value="<%=startYear%>" size="7" maxlength="4" />
        <input name="endMonth" type="hidden" id="endMonth" value="<%=endMonth%>" size="5" maxlength="2" />
        <input name="endDay" type="hidden" id="endDay" value="<%=endDay%>" size="5" maxlength="2" />
        <input name="endYear" type="hidden" id="endYear" value="<%=endYear%>" size="7" maxlength="4" />
        <input name="host" type="hidden" id="host" value="<%=host%>" size="72" maxlength="72" tabindex="9" />
        <input name="district" type="hidden" id="district" value="<%=district%>" size="24" maxlength="24" />
        <input name="fleet" type="hidden" id="fleet" value="<%=fleet%>" size="6" maxlength="3" />
        <input name="city" type="hidden" id="city" value="<%=city%>" size="24" maxlength="24" tabindex="12" />
        <input type="hidden" name="stateProvince" id="stateProvince" value="<%=stateProvince%>" />
        <input type="hidden" name="country" id="country" value="<%=country%>" />
        <input name="contact" type="hidden" id="contact" value="<%=contact%>" tabindex="15" size="24" maxlength="24" />
        <input name="eddress" type="hidden" id="eddress" value="<%=eddress%>" tabindex="16"  size="40" maxlength="82" />
        <input name="phone" type="hidden" id="phone" value="<%=phone%>" tabindex="17" size="18" maxlength="18" />
        <input name="eddress2" type="hidden" id="eddress2" value="<%=eddress2%>" tabindex="18" size="40"  maxlength="82" />
        <input name="website" type="hidden" id="website" value="<%=website%>" size="75" maxlength="75" tabindex="19" />
        <textarea name="comments" id="comments" class="commentArea" value="<%=comments%>" cols="75" rows="4" size="1" tabindex="20"></textarea>
        <input type="hidden" name="MM_insert" value="eventAdd" />
      </form>
	  <p>Thank you. The recaptcha match worked. <a href="eventSelect.asp">ILCA Calendar</a></p>
		<% End If %>
<%
' The code below supplied by Mark Short 
 
' returns string the can be written where you would like the reCAPTCHA challenged placed on your page 
function recaptcha_challenge_writer(publickey) 
  recaptcha_challenge_writer = "<script type=""text/javascript"">" & _ 
  "var RecaptchaOptions = {" & _ 
  " theme : 'white'," & _ 
  " tabindex : 0" & _ 
  "};" & _ 
  "</script>" & _ 
  "<script type=""text/javascript"" src=""http://api.recaptcha.net/challenge?k=" & publickey & """></script>" & _ 
  "<noscript>" & _ 
  "<iframe src=""http://api.recaptcha.net/noscript?k=" & publickey & """ frameborder=""1""></iframe><br>" & _ 
  "<textarea name=""recaptcha_challenge_field"" rows=""3"" cols=""40""></textarea>" & _ 
  "<input type=""hidden"" name=""recaptcha_response_field"" value=""manual_challenge"">" & _ 
  "</noscript>" 
end function 
 
function recaptcha_confirm(privkey,rechallenge,reresponse) 
  ' Test the captcha field 
  Dim VarString 
  VarString = _ 
  "privatekey=" & privkey & _ 
  "&remoteip=" & Request.ServerVariables("REMOTE_ADDR") & _ 
  "&challenge=" & rechallenge & _ 
  "&response=" & reresponse 
  Dim objXmlHttp 
  Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") 
  objXmlHttp.open "POST", "http://api-verify.recaptcha.net/verify", False 
  objXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 
  objXmlHttp.send VarString 
  Dim ResponseString 
  ResponseString = split(objXmlHttp.responseText, vblf) 
  Set objXmlHttp = Nothing 
  if ResponseString(0) = "true" then 
    ' They answered correctly 
    recaptcha_confirm = "" 
  else 
    ' They answered incorrectly 
    recaptcha_confirm = ResponseString(1) 
  end if 
end function 
%>
      <!-- InstanceEndEditable --> </div>

Open in new window

The problem is that you are collecting the values from the form, then encoding them ready for the database, then instead of using the newly encoded values, you are going back and collecting them from the form again.

This is what happens when you mix Dreamweaver's logic with other scripts found from elsewhere - it all gets a bit confusing!

In the part of the script that builds the database code, try swapping the form variable for the one that has already been encoded.  So,

   MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 30, Request.Form("classification")) ' adVarWChar

becomes

  MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 30, classification) ' adVarWChar


Without making the above changes, I just posted a test in Firefox and it seemed to have worked.  If it hasn't can you clarify exactly what is not happening.
Avatar of slegy

ASKER

I am so sorry this is stretching out so long. It still isn't working. The "Insert Record" behavior in Dreamweaver requires a form. I discovered that after I made the changes you specified above. When that didn't work I then tried to remove the form - which causes Insert Record to error out.
I have noticed something weird. With the way the code is now laid out. the source line for the form reads:
<form method="POST" action="<%=MM_editAction%>" name="eventAdd" id="eventAdd">
When I view source online it reads:
<form method="POST" action="/racing/calendar/eventValidate.asp" name="eventAdd" id="eventAdd">
This is the point where I threw in the towel yesterday. But at one point I'm quite certain it worked. I have three records in the event table that I created yesterday morning. I made some adjustments for the Captcha and lost it. Will continue experimenting.
Avatar of slegy

ASKER

Apparently there is nothing wrong with the from line. It works the same way in the currently functioning forms.
ASKER CERTIFIED SOLUTION
Avatar of Rouchie
Rouchie
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of slegy

ASKER

You are fantastic and I've learned a ton - painful though it be. The Add Event is working perfectly - the Update Event not quite yet. I'm sure it is because, as you say, the code is so longwinded and INCREDIBLY hard to read. I've tried a variety of different things, without success.
The two forms now are eventUpdate.asp and eventupdateValidate.asp. The record ID passed from eventUpdate.asp is:
        <input type="hidden" name="MM_recordId" value="<%= rsEvent.Fields.Item("ID").Value %>" />
In eventupdateValidate.asp I'm guess that  the MM_editAction isn't needed, which is why I commented it out (but I could be wrong). I'm getting no error messages. I modified the MMColParam code to directly reference ID.

Pages:
http://cherryle.win.aplus.net/racing/calendar/eventUpdate.asp?ID=192
http://cherryle.win.aplus.net/racing/calendar/eventupdateValidate.asp
 

eventupdateValidate.asp:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../../Connections/eventCalendar.asp" -->
<!--#include file="adovbs.asp"-->
<!--#include file="iasutil.asp"-->
<%
' On Error Resume Next
 
' Classsic ASP pages created by Andre F Bruton
' E-mail: andre@bruton.co.za
' Date: 2008/01/19
 
classification             = SQLEncode(Request("classification"))
eventTitle                 = SQLEncode(Request("eventTitle"))
eventTitle2                = SQLEncode(Request("eventTitle2"))
startMonth                 = SQLEncode(Request("startMonth"))
startDay                   = SQLEncode(Request("startDay"))
startYear                  = SQLEncode(Request("startYear"))
endMonth                   = SQLEncode(Request("endMonth"))
endDay                     = SQLEncode(Request("endDay"))
endYear                    = SQLEncode(Request("endYear"))
host                       = SQLEncode(Request("host"))
district                   = SQLEncode(Request("district"))
fleet                      = SQLEncode(Request("fleet"))
city                       = SQLEncode(Request("city"))
stateProvince              = SQLEncode(Request("stateProvince"))
country                    = SQLEncode(Request("country"))
contact                    = SQLEncode(Request("contact"))
eddress                    = SQLEncode(Request("eddress"))
phone                      = SQLEncode(Request("phone"))
eddress2                   = SQLEncode(Request("eddress2"))
website                    = SQLEncode(Request("website"))
comments                   = SQLEncode(Request("comments"))
ID                         = SQLEncode(Request("ID"))
recaptcha_challenge_field  = Request("recaptcha_challenge_field")
recaptcha_response_field   = Request("recaptcha_response_field")
recaptcha_private_key      = "6LewIAUAAAAAAAjmgc9mSer6yjKmhN8Y0TageoGt"
recaptcha_public_key       = "6LewIAUAAAAAACE74U2jHkO2TEVvUL-64tJvR2g-"
browser                    = Request.ServerVariables("HTTP_USER_AGENT")
ip                         = Request.ServerVariables("REMOTE_HOST")
%>
<%
Dim rsEvent__MMColParam
rsEvent__MMColParam = "0"
If (ID <> "") Then 
  rsEvent__MMColParam = ID  
End If
%>
. . . .
      <%else
			' execute the update
			Dim MM_editCmd
			'Dim MM_editAction
			'MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
			'If (Request.QueryString <> "") Then
			'  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
			'End If
		
			Set MM_editCmd = Server.CreateObject ("ADODB.Command")
			MM_editCmd.ActiveConnection = MM_eventCalendar_STRING
			MM_editCmd.CommandText = "UPDATE eventCalendar SET classification = ?, eventTitle = ?, [eventTitle-long] = ?, startMonth = ?, startDay = ?, startYear = ?, endMonth = ?, endDay = ?, endYear = ?, [host] = ?, district = ?, fleet = ?, city = ?, stateProvince = ?, country = ?, contact = ?, eddress = ?, phone = ?, eddress2 = ?, website = ?, comments = ? WHERE ID = ?" 
			MM_editCmd.Prepared = true
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 30, classification) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 42, eventTitle) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 100, eventTitle2) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 2, startMonth) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202, 1, 2, startDay) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 202, 1, 4, startYear) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 202, 1, 2, endMonth) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 202, 1, 2, endDay) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param9", 202, 1, 4, endYear) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param10", 202, 1, 50, host) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param11", 202, 1, 50, district) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param12", 5, 1, -1, fleet) ' adDouble
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param13", 202, 1, 28, city) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param14", 202, 1, 30, stateProvince) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param15", 202, 1, 36, country) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param16", 202, 1, 50, contact) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param17", 202, 1, 100, eddress) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param18", 202, 1, 25, phone) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param19", 202, 1, 100, eddress2) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param20", 202, 1, 100, website) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param21", 203, 1, 1073741823, comments) ' adLongVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param22", 5, 1, -1, ID) ' adDouble
			MM_editCmd.Execute
			MM_editCmd.ActiveConnection.Close

Open in new window

Its difficult to know if you should have commented out MM_editAction without seeing the whole code, because I don't know if the variable is used elsewhere.  If you do a search and can't find it anywhere else, then yes, remove it.

I just tested the update form and it worked fine.  The only issue was that the internet address field had "lightningclass.org" as the value, but your ASP validation demanded the address contained "WWW" and "HTTP" inside it.  Once I therefore changed the value to "http://www.lightningclass.org" then it saved fine.

If more problems exist, let me know what is/not happening.
Avatar of slegy

ASKER

That is exactly the test I was working with yesterday. It looks like it works, but the update doesn't take place. When you go back and check the event display or look at the database, nothing changes - the field still contains "lightningclass.org."
I burned out yesterday but will continue testing today.
Can you post the full code for both update pages (form and save code) and I'll investigate?
Avatar of slegy

ASKER

I hate doing this to you. I've been doing some more testing. It appears that the ID field is empty - which would explain why the update is not working. I haven't yet figured out why. I created a new test version: eventtestUpdate.asp. It displays the ID (which is normally hidden). It is showing the correct value. But when I try to print the value in eventupdateValidate.asp I get nothing (I believe I'm doing it correctly). I'm also printing the fleet number, which is the only other numeric field. It is correct. This must be a forrest/trees scenario. All the other fields are being passed correctly.
http://cherryle.win.aplus.net/racing/calendar/eventtestUpdate.asp?ID=192
http://cherryle.win.aplus.net/racing/calendar/eventupdateValidate.asp
 

eventupdateValidate.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../../Connections/eventCalendar.asp" -->
<!--#include file="adovbs.asp"-->
<!--#include file="iasutil.asp"-->
<%
' On Error Resume Next
 
' Classsic ASP pages created by Andre F Bruton
' E-mail: andre@bruton.co.za
' Date: 2008/01/19
 
classification             = SQLEncode(Request("classification"))
eventTitle                 = SQLEncode(Request("eventTitle"))
eventTitle2                = SQLEncode(Request("eventTitle2"))
startMonth                 = SQLEncode(Request("startMonth"))
startDay                   = SQLEncode(Request("startDay"))
startYear                  = SQLEncode(Request("startYear"))
endMonth                   = SQLEncode(Request("endMonth"))
endDay                     = SQLEncode(Request("endDay"))
endYear                    = SQLEncode(Request("endYear"))
host                       = SQLEncode(Request("host"))
district                   = SQLEncode(Request("district"))
fleet                      = SQLEncode(Request("fleet"))
city                       = SQLEncode(Request("city"))
stateProvince              = SQLEncode(Request("stateProvince"))
country                    = SQLEncode(Request("country"))
contact                    = SQLEncode(Request("contact"))
eddress                    = SQLEncode(Request("eddress"))
phone                      = SQLEncode(Request("phone"))
eddress2                   = SQLEncode(Request("eddress2"))
website                    = SQLEncode(Request("website"))
comments                   = SQLEncode(Request("comments"))
ID                         = SQLEncode(Request("ID"))
recaptcha_challenge_field  = Request("recaptcha_challenge_field")
recaptcha_response_field   = Request("recaptcha_response_field")
recaptcha_private_key      = "6LewIAUAAAAAAAjmgc9mSer6yjKmhN8Y0TageoGt"
recaptcha_public_key       = "6LewIAUAAAAAACE74U2jHkO2TEVvUL-64tJvR2g-"
browser                    = Request.ServerVariables("HTTP_USER_AGENT")
ip                         = Request.ServerVariables("REMOTE_HOST")
%>
<%
Dim rsEvent__MMColParam
rsEvent__MMColParam = "0"
If (ID <> "") Then 
  rsEvent__MMColParam = ID  
End If
%>
<%
Dim rsEvent
Dim rsEvent_cmd
Dim rsEvent_numRows
 
Set rsEvent_cmd = Server.CreateObject ("ADODB.Command")
rsEvent_cmd.ActiveConnection = MM_eventCalendar_STRING
rsEvent_cmd.CommandText = "SELECT * FROM eventCalendar WHERE ID = ?" 
rsEvent_cmd.Prepared = true
rsEvent_cmd.Parameters.Append rsEvent_cmd.CreateParameter("param1", 5, 1, -1, rsEvent__MMColParam) ' adDouble
 
Set rsEvent = rsEvent_cmd.Execute
rsEvent_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
 
Repeat1__numRows = -1
Repeat1__index = 0
rsEvent_numRows = rsEvent_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- InstanceBegin template="/Templates/mainLayout.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Event Updated in the ILCA Calendar</title>
<!-- InstanceEndEditable --><!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<link href="../../assets/favicon.ico" rel="shortcut icon" />
<link href="../../css/mainLayout.css" rel="stylesheet" type="text/css" />
<link href="../../css/navMenu.css" rel="stylesheet" type="text/css" />
<link href="../../css/ilcaStyles.css" rel="stylesheet" type="text/css" />
<link href="../../css/document.css" rel="stylesheet" type="text/css" />
<script src="../../scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<!-- InstanceBeginEditable name="styles" --><!-- InstanceEndEditable --><!-- InstanceParam name="setdatetype" type="text" value="" --><!-- InstanceParam name="cleanup" type="text" value="" -->
</head>
<body onLoad="" onUnload="">
<%
Response.Buffer = True
If (Request.ServerVariables("HTTPS") = "on") Then
    Dim xredir__, xqstr__
 
    xredir__ = "http://" & Request.ServerVariables("SERVER_NAME") & _
               Request.ServerVariables("SCRIPT_NAME")
    xqstr__ = Request.ServerVariables("QUERY_STRING")
 
    if xqstr__ <> "" Then xredir__ = xredir__ & "?" & xqstr__
 
    Response.redirect xredir__
End if
%>
<div id="wrapper">
  <div id="header">
    <div id="rotatingGlobe"> <!-- InstanceBeginEditable name="rotatingGlobe" --> <!-- InstanceEndEditable --> </div>
    <div id="hdrLink"><a href="../../index.asp"><img src="../../assets/images/mainTemplate/headerImg.png" border="0" /></a></div>
  </div>
  <div id="sidebar">
    <div id="navigation">
      <!-- menu script itself. you should not modify this file -->
      <script type="text/javascript" language="JavaScript" src="../../scripts/navMenu.js"></script>
      <!-- items structure. menu hierarchy and links are stored there -->
      <script type="text/javascript" language="JavaScript" src="../../scripts/navMenu_items.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu_items.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu2_items.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/storeMenu_items.js"></script>
      <!-- files with geometry and styles structures -->
      <script type="text/javascript" language="JavaScript" src="../../scripts/navMenu_tpl.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu_tpl.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu2_tpl.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/storeMenu_tpl.js"></script>
      <script type="text/javascript" language="javascript">
	<!--//
	// Make sure the menu initialization is right above the closing &lt;/body&gt; tag
	// Moving it inside other tags will not affect the position of the menu on
	// the page. If you need this feature please consider Tigra Menu GOLD.
 
	// each menu gets two parameters (see demo files)
	// 1. items structure
	// 2. geometry structure
 
	new menu (MENU_ITEMS, MENU_TPL);
 
	// If you don't see the menu then check JavaScript console of the browser for the error messages
	// "Variable is not defined" error indicates that there's syntax error in that variable's definition
	// or the file with that variable isn't properly linked to the HTML document
	//-->
</script>
    </div>
    <div id="sbar-image1"><img src="../../assets/images/mainTemplate/panAm.jpg" width="116" height="129" /></div>
    <div id="sbar-image2"><a href="../../membership/joinRenew/membershipOptions.asp"><img src="../../assets/images/mainTemplate/joinILCA.png" alt="Join the ILCA" width="113" height="113" border="0" /></a></div>
    <div id="sbar-search"></div>
  </div>
  <div id="background">
    <div id="mainContent"> <!-- InstanceBeginEditable name="mainContent" -->
      <div id = "docHdr">
        <h3>Event Added to the ILCA Calendar</h3>
      </div>
<% 
	Dim errorText
	errorText = ""
	If Request.Form("ID") <> 192 And Request.Form("ID") <> "192" Then
		Response.Write("ID Check - " & Request.Form("ID") & "ID Error - ")
		Response.Write(Request.Form("fleet") & " Fleet")
		errorText = errorText & "<li>Error: ID field incorrect!</li>"
	End If
	If Len(Request.Form("ID")) = 0 Then
		Response.Write("   ID Check2 - " & Request.Form("ID") & "ID Error")
		errorText = errorText & "<li>Error: ID field incorrect!</li>"
	End If
	If Trim(Request.Form("classification")) = "Select an Event Classification" Then
		errorText = errorText & "<li>Please specify an event classification!</li>"
	End If
	If Request.Form("eventTitle") = "" Then
		errorText = errorText & "<li>Error: Event Title cannot be blank!</li>"
	End If
	If Request.Form("startMonth") = "Month" Then
		errorText = errorText & "<li>Error: Start month must be selected!</li>"
	End If
	If Request.Form("startDay") = "Day" Then
		errorText = errorText & "<li>Error: Start day must be selected!</li>"
	End If
	If Request.Form("endMonth") = "Month" Then
		errorText = errorText & "<li>Error: End month must be selected!</li>"
	End If
	If Request.Form("endDay") = "Day" Then
		errorText = errorText & "<li>Error: End day must be selected!</li>"
	End If
	If Left(website,7) <> "http://" Then
		errorText = errorText & "<li>Error: Website address must inclue http://!</li>"
	End If
	If Mid(website,8,4) <> "www." Then
		errorText = errorText & "<li>Error: Website address must inclue www.!</li>"	
	End If
	cTemp = recaptcha_confirm(recaptcha_private_key, recaptcha_challenge_field, recaptcha_response_field)
	If cTemp <> "" Then
		errorText = errorText & "<li>Error: An error occured in the reCaptcha wording!</li>"
    End If
	 
	If errorText <> "" Then
%>
      <h3 style="font-weight:bold; color:red;">
      Error!
      </h3>
      <p>The following errors occurred.   Please press back in your browser and try again.</p>
      <ul style="font-weight:bold; color:red;">
        <%= errorText %>
      </ul>
      <%else%>
      <h3 style="font-weight:bold; color:red;">
      No errors!
      </h3>
        <%
			' execute the update
			Dim MM_editCmd
			Dim MM_editAction
			MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
			If (ID <> "") Then
			  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(ID)
			End If
		
			Set MM_editCmd = Server.CreateObject ("ADODB.Command")
			MM_editCmd.ActiveConnection = MM_eventCalendar_STRING
			MM_editCmd.CommandText = "UPDATE eventCalendar SET classification = ?, eventTitle = ?, [eventTitle-long] = ?, startMonth = ?, startDay = ?, startYear = ?, endMonth = ?, endDay = ?, endYear = ?, [host] = ?, district = ?, fleet = ?, city = ?, stateProvince = ?, country = ?, contact = ?, eddress = ?, phone = ?, eddress2 = ?, website = ?, comments = ? WHERE ID = ?" 
			MM_editCmd.Prepared = true
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 30, classification) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 42, eventTitle) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 100, eventTitle2) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 2, startMonth) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202, 1, 2, startDay) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 202, 1, 4, startYear) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 202, 1, 2, endMonth) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 202, 1, 2, endDay) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param9", 202, 1, 4, endYear) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param10", 202, 1, 50, host) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param11", 202, 1, 50, district) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param12", 5, 1, -1, fleet) ' adDouble
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param13", 202, 1, 28, city) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param14", 202, 1, 30, stateProvince) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param15", 202, 1, 36, country) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param16", 202, 1, 50, contact) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param17", 202, 1, 100, eddress) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param18", 202, 1, 25, phone) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param19", 202, 1, 100, eddress2) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param20", 202, 1, 100, website) ' adVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param21", 203, 1, 1073741823, comments) ' adLongVarWChar
			MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param22", 5, 1, -1, ID) ' adDouble
			MM_editCmd.Execute
			MM_editCmd.ActiveConnection.Close
		
			' append the query string to the redirect URL
			'Dim MM_editRedirectUrl
			'MM_editRedirectUrl = "eventSelect.asp"
			'If (Request.QueryString <> "") Then
			'  If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
			'	MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
			'  Else
			'	MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
			'  End If
			'End If
			'Response.Redirect(MM_editRedirectUrl)
		  'End If
		'End If
%>
		<p><span class="redHlite"><strong>Thank you</strong>. The recaptcha match worked. Your regatta information has been updated."</span>  <a href="eventSelect.asp">ILCA Calendar</a></p>
	    <% End If %>
<%
		' The code below supplied by Mark Short 
		
		function recaptcha_confirm(privkey,rechallenge,reresponse) 
		  ' Test the captcha field 
		  Dim VarString 
		  VarString = _ 
		  "privatekey=" & privkey & _ 
		  "&remoteip=" & Request.ServerVariables("REMOTE_ADDR") & _ 
		  "&challenge=" & rechallenge & _ 
		  "&response=" & reresponse 
		  Dim objXmlHttp 
		  Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") 
		  objXmlHttp.open "POST", "http://api-verify.recaptcha.net/verify", False 
		  objXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 
		  objXmlHttp.send VarString 
		  Dim ResponseString 
		  ResponseString = split(objXmlHttp.responseText, vblf) 
		  Set objXmlHttp = Nothing 
		  if ResponseString(0) = "true" then 
			' They answered correctly 
			recaptcha_confirm = "" 
		  else 
			' They answered incorrectly 
			recaptcha_confirm = ResponseString(1) 
		  end if 
		end function 
%>
      <!-- InstanceEndEditable --> </div>
  </div>
  <div id="clear"></div>
  <div id="footer">
    <p><u><a href="../../membership/joinRenew/membershipOptions.asp" class="ftrLinks">Membership</a></u> | <u><a href="eventSelect.asp" class="ftrLinks">Racing</a></u> | <u><a href="../../classRules/documents/ilcaBylaws.asp" class="ftrLinks">Class Rules</a></u> | <u><a href="../../photoGallery/photos2008/index.asp" class="ftrLinks">Photo Gallery</a></u> | <u class="ftrLinks"><a href="../../marketplace/store/index.asp">Marketplace</a></u> | <u><a href="../../contacts/index.asp" class="ftrLinks">Contacts</a></u> | <u class="ftrLinks"><a href="../../siteMap.asp">Site Map</a></u><br />
      All Rights ReservedInternational Lightning Class Association<br />
      <u><a href="mailto:office@lightningclass.org" class="ftrLinks">office@lightningclass.org</a></u><br />
      7625 South Yampa Street, Centennial, Colorado 80016  Phone: 303-325-5886  Fax: 303-699-2178  Skype: ilcaoffice</p>
  </div>
</div>
</body>
<!-- InstanceEnd -->
</html>
<%
rsEvent.Close()
Set rsEvent = Nothing
%>
 
eventtestUpdate.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../../Connections/ilcaData.asp" -->
<!--#include file="../../Connections/eventCalendar.asp" -->
<%
' On Error Resume Next
 
' Classsic ASP pages created by Andre F Bruton
' E-mail: andre@bruton.co.za
' Date: 2008/01/19
 
 
recaptcha_public_key       = "6LewIAUAAAAAACE74U2jHkO2TEVvUL-64tJvR2g-"
%>
<%
Dim rsStates
Dim rsStates_cmd
Dim rsStates_numRows
 
Set rsStates_cmd = Server.CreateObject ("ADODB.Command")
rsStates_cmd.ActiveConnection = MM_ilcaData_STRING
rsStates_cmd.CommandText = "SELECT * FROM stateCodes ORDER BY [stateName]" 
rsStates_cmd.Prepared = true
 
Set rsStates = rsStates_cmd.Execute
rsStates_numRows = 0
%>
<%
Dim rsCountry
Dim rsCountry_cmd
Dim rsCountry_numRows
 
Set rsCountry_cmd = Server.CreateObject ("ADODB.Command")
rsCountry_cmd.ActiveConnection = MM_ilcaData_STRING
rsCountry_cmd.CommandText = "SELECT * FROM countryCodes ORDER BY [countryName]" 
rsCountry_cmd.Prepared = true
 
Set rsCountry = rsCountry_cmd.Execute
rsCountry_numRows = 0
%>
<%
Dim rsDistricts
Dim rsDistricts_cmd
Dim rsDistricts_numRows
 
Set rsDistricts_cmd = Server.CreateObject ("ADODB.Command")
rsDistricts_cmd.ActiveConnection = MM_ilcaData_STRING
rsDistricts_cmd.CommandText = "SELECT * FROM activeDistricts ORDER BY [districtName]" 
rsDistricts_cmd.Prepared = true
 
Set rsDistricts = rsDistricts_cmd.Execute
rsDistricts_numRows = 0
%>
<%
Dim rsFleet
Dim rsFleet_cmd
Dim rsFleet_numRows
 
Set rsFleet_cmd = Server.CreateObject ("ADODB.Command")
rsFleet_cmd.ActiveConnection = MM_ilcaData_STRING
rsFleet_cmd.CommandText = "SELECT * FROM activeFleets ORDER BY [fleet]" 
rsFleet_cmd.Prepared = true
 
Set rsFleet = rsFleet_cmd.Execute
rsFleet_numRows = 0
%>
<%
Dim rseventClass
Dim rseventClass_cmd
Dim rseventClass_numRows
 
Set rseventClass_cmd = Server.CreateObject ("ADODB.Command")
rseventClass_cmd.ActiveConnection = MM_eventCalendar_STRING
rseventClass_cmd.CommandText = "SELECT * FROM eventClass" 
rseventClass_cmd.Prepared = true
 
Set rseventClass = rseventClass_cmd.Execute
rseventClass_numRows = 0
%>
<%
Dim rsEvent__MMColParam
rsEvent__MMColParam = "0"
If (Request.QueryString("ID")   <> "") Then 
  rsEvent__MMColParam = Request.QueryString("ID")  
End If
%>
<%
Dim rsEvent
Dim rsEvent_cmd
Dim rsEvent_numRows
 
Set rsEvent_cmd = Server.CreateObject ("ADODB.Command")
rsEvent_cmd.ActiveConnection = MM_eventCalendar_STRING
rsEvent_cmd.CommandText = "SELECT * FROM eventCalendar WHERE ID = ?" 
rsEvent_cmd.Prepared = true
rsEvent_cmd.Parameters.Append rsEvent_cmd.CreateParameter("param1", 5, 1, -1, rsEvent__MMColParam) ' adDouble
 
Set rsEvent = rsEvent_cmd.Execute
rsEvent_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
 
Repeat1__numRows = -1
Repeat1__index = 0
rsEvent_numRows = rsEvent_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- InstanceBegin template="/Templates/mainLayout.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Update an Event in the ILCA Calendar</title>
<!-- TinyMCE -->
<script language="javascript" type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
		// Theme options
		theme_advanced_buttons1 : "save,newdocument,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect,charmap,forecolor,iespell",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,|,anchor,image,cleanup,help,code,insertdate,inserttime,preview,backcolor",
		theme_advanced_disable : "save,newdocument,strikethrough,styleselect,formatselect,pastetext,pasteword,blockquote,anchor,cleanup,help,code,insertdate,inserttime,preview,backcolor,tablecontrols,separator,hr,removeformat,visualaid,separator,sub,sup,separator,emotions,media,advhr,separator,print,ltr,rtl,fullscreen,insertlayer,moveforward,movebackward,absolute,separator,styleprops,separator,cite,abbr,acronym,del,ins,attribs,separator,visualchars,nonbreaking,template,pagebreak",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
 
		// Drop lists for link/image/media/template dialogs
		external_link_list_url : "tinymce/jscripts/tiny_mce/lists/link_list.js",
		external_image_list_url : "tinymce/jscripts/tiny_mce/lists/image_list.js"
	});
</script>
<!-- /TinyMCE -->
<!-- InstanceEndEditable --><!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<link href="../../assets/favicon.ico" rel="shortcut icon" />
<link href="../../css/mainLayout.css" rel="stylesheet" type="text/css" />
<link href="../../css/navMenu.css" rel="stylesheet" type="text/css" />
<link href="../../css/ilcaStyles.css" rel="stylesheet" type="text/css" />
<link href="../../css/document.css" rel="stylesheet" type="text/css" />
<script src="../../scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<!-- InstanceBeginEditable name="styles" -->
<link href="../../css/eventUpdate.css" rel="stylesheet" type="text/css" />
<link href="../../css/buttons.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable --><!-- InstanceParam name="setdatetype" type="text" value="" --><!-- InstanceParam name="cleanup" type="text" value="" -->
</head>
<body onload="" onunload="">
<%
Response.Buffer = True
If (Request.ServerVariables("HTTPS") = "on") Then
    Dim xredir__, xqstr__
 
    xredir__ = "http://" & Request.ServerVariables("SERVER_NAME") & _
               Request.ServerVariables("SCRIPT_NAME")
    xqstr__ = Request.ServerVariables("QUERY_STRING")
 
    if xqstr__ <> "" Then xredir__ = xredir__ & "?" & xqstr__
 
    Response.redirect xredir__
End if
%>
<div id="wrapper">
  <div id="header">
    <div id="rotatingGlobe"> <!-- InstanceBeginEditable name="rotatingGlobe" -->
      <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','88','height','88','title','Rotating World Globe','src','../../assets/media/rotatingGlobe','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','wmode','transparent','movie','../../assets/media/rotatingGlobe' ); //end AC code
</script>
      <noscript>
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="88" height="88" title="Rotating World Globe">
        <param name="movie" value="../../assets/media/rotatingGlobe.swf" />
        <param name="quality" value="high" />
        <param name="wmode" value="transparent" />
        <embed src="../../assets/media/rotatingGlobe.swf" width="88" height="88" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"></embed>
      </object>
      </noscript>
      <!-- InstanceEndEditable --> </div>
    <div id="hdrLink"><a href="../../index.asp"><img src="../../assets/images/mainTemplate/headerImg.png" border="0" /></a></div>
  </div>
  <div id="sidebar">
    <div id="navigation">
      <!-- menu script itself. you should not modify this file -->
      <script type="text/javascript" language="JavaScript" src="../../scripts/navMenu.js"></script>
      <!-- items structure. menu hierarchy and links are stored there -->
      <script type="text/javascript" language="JavaScript" src="../../scripts/navMenu_items.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu_items.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu2_items.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/storeMenu_items.js"></script>
      <!-- files with geometry and styles structures -->
      <script type="text/javascript" language="JavaScript" src="../../scripts/navMenu_tpl.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu_tpl.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu2_tpl.js"></script>
      <script type="text/javascript" language="JavaScript" src="../../scripts/storeMenu_tpl.js"></script>
      <script type="text/javascript" language="javascript">
	<!--//
	// Make sure the menu initialization is right above the closing &lt;/body&gt; tag
	// Moving it inside other tags will not affect the position of the menu on
	// the page. If you need this feature please consider Tigra Menu GOLD.
 
	// each menu gets two parameters (see demo files)
	// 1. items structure
	// 2. geometry structure
 
	new menu (MENU_ITEMS, MENU_TPL);
 
	// If you don't see the menu then check JavaScript console of the browser for the error messages
	// "Variable is not defined" error indicates that there's syntax error in that variable's definition
	// or the file with that variable isn't properly linked to the HTML document
	//-->
</script>
    </div>
    <div id="sbar-image1"><img src="../../assets/images/mainTemplate/panAm.jpg" width="116" height="129" /></div>
    <div id="sbar-image2"><a href="../../membership/joinRenew/membershipOptions.asp"><img src="../../assets/images/mainTemplate/joinILCA.png" alt="Join the ILCA" width="113" height="113" border="0" /></a></div>
    <div id="sbar-search"></div>
  </div>
  <div id="background">
    <div id="mainContent"> <!-- InstanceBeginEditable name="mainContent" -->
      <div align="center">
        <h3><br />
          <span class="headers">Update an Event in the ILCA Calendar</span></h3>
      </div>
      <form action="eventupdateValidate.asp" method="post" name="eventUpdate" id="eventUpdate">
        <fieldset id="eventInfo">
        <legend class="legend">Event Information  * Indicates required fields</legend>
        <div id="event"><br />
          <label for="classification">Classification:<span class="smallRed">*</span></span></label>
          <select name="classification" id="classification" size="1">
            <%
While (NOT rseventClass.EOF)
%>
            <option value="<%=(rseventClass.Fields.Item("eventClass").Value)%>" <%If (Not isNull((rsEvent.Fields.Item("classification").Value))) Then If (CStr(rseventClass.Fields.Item("eventClass").Value) = CStr((rsEvent.Fields.Item("classification").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rseventClass.Fields.Item("eventClass").Value)%></option>
            <%
  rseventClass.MoveNext()
Wend
If (rseventClass.CursorType > 0) Then
  rseventClass.MoveFirst
Else
  rseventClass.Requery
End If
%>
          </select>
          <label for="eventTitle"><br />
          Event Title:<span class="smallRed">*</span></label>
          <input name="eventTitle" type="text" id="eventTitle" tabindex="1" value="<%=(rsEvent.Fields.Item("eventTitle").Value)%>" size="48"  maxlength="42" />
          <span class="smallRed"> Maximum 42 characters</span><br />
          <label for="eventTitle2">Title-Long:</label>
          <input name="eventTitle2" type="text" id="eventTitle2" tabindex="2" value="<%=(rsEvent.Fields.Item("eventTitle-long").Value)%>" size="70"  maxlength="82" />
          <br />
          <label for="startMonth">Start Date:<span class="smallRed">*</span></label>
          <label for="startMonth"></label>
          <label for="startDay"> </label>
          <label for="startDay"></label>
          <label for="startYear"></label>
          <select name="startMonth" id="startMonth" size="1" tabindex="3">
            <option selected="selected" value="" <%If (Not isNull((rsEvent.Fields.Item("startMonth").Value))) Then If ("" = CStr((rsEvent.Fields.Item("startMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Month</option>
            <option value="01" <%If (Not isNull((rsEvent.Fields.Item("startMonth").Value))) Then If ("01" = CStr((rsEvent.Fields.Item("startMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>January</option>
            <option value="02" <%If (Not isNull((rsEvent.Fields.Item("startMonth").Value))) Then If ("02" = CStr((rsEvent.Fields.Item("startMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>February</option>
            <option value="03" <%If (Not isNull((rsEvent.Fields.Item("startMonth").Value))) Then If ("03" = CStr((rsEvent.Fields.Item("startMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>March</option>
            <option value="04" <%If (Not isNull((rsEvent.Fields.Item("startMonth").Value))) Then If ("04" = CStr((rsEvent.Fields.Item("startMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>April</option>
            <option value="05" <%If (Not isNull((rsEvent.Fields.Item("startMonth").Value))) Then If ("05" = CStr((rsEvent.Fields.Item("startMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>May</option>
            <option value="06" <%If (Not isNull((rsEvent.Fields.Item("startMonth").Value))) Then If ("06" = CStr((rsEvent.Fields.Item("startMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>June</option>
            <option value="07" <%If (Not isNull((rsEvent.Fields.Item("startMonth").Value))) Then If ("07" = CStr((rsEvent.Fields.Item("startMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>July</option>
            <option value="08" <%If (Not isNull((rsEvent.Fields.Item("startMonth").Value))) Then If ("08" = CStr((rsEvent.Fields.Item("startMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>August</option>
            <option value="09" <%If (Not isNull((rsEvent.Fields.Item("startMonth").Value))) Then If ("09" = CStr((rsEvent.Fields.Item("startMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>September</option>
            <option value="10" <%If (Not isNull((rsEvent.Fields.Item("startMonth").Value))) Then If ("10" = CStr((rsEvent.Fields.Item("startMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>October</option>
            <option value="11" <%If (Not isNull((rsEvent.Fields.Item("startMonth").Value))) Then If ("11" = CStr((rsEvent.Fields.Item("startMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>November</option>
            <option value="12" <%If (Not isNull((rsEvent.Fields.Item("startMonth").Value))) Then If ("12" = CStr((rsEvent.Fields.Item("startMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>December</option>
          </select>
          <label for="label"> </label>
          <select name="startDay" id="startDay" size="1" tabindex="4">
            <option selected="selected" value="" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Day</option>
            <option value="1" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("1" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>1</option>
            <option value="2" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("2" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2</option>
            <option value="3" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("3" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>3</option>
            <option value="4" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("4" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>4</option>
            <option value="5" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("5" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>5</option>
            <option value="6" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("6" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>6</option>
            <option value="7" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("7" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>7</option>
            <option value="8" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("8" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>8</option>
            <option value="9" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("9" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>9</option>
            <option value="10" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("10" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>10</option>
            <option value="11" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("11" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>11</option>
            <option value="12" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("12" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>12</option>
            <option value="13" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("13" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>13</option>
            <option value="14" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("14" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>14</option>
            <option value="15" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("15" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>15</option>
            <option value="16" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("16" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>16</option>
            <option value="17" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("17" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>17</option>
            <option value="18" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("18" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>18</option>
            <option value="19" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("19" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>19</option>
            <option value="20" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("20" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>20</option>
            <option value="21" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("21" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>21</option>
            <option value="22" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("22" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>22</option>
            <option value="23" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("23" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>23</option>
            <option value="24" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("24" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>24</option>
            <option value="25" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("25" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>25</option>
            <option value="26" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("26" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>26</option>
            <option value="27" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("27" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>27</option>
            <option value="28" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("28" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>28</option>
            <option value="29" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("29" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>29</option>
            <option value="30" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("30" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>30</option>
            <option value="31" <%If (Not isNull((rsEvent.Fields.Item("startDay").Value))) Then If ("31" = CStr((rsEvent.Fields.Item("startDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>31</option>
          </select>
          <label for="label2"></label>
          <select name="startYear" id="startYear" size="1" tabindex="5">
            <option value="" <%If (Not isNull((rsEvent.Fields.Item("startYear").Value))) Then If ("" = CStr((rsEvent.Fields.Item("startYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Year</option>
            <option value="2008" <%If (Not isNull((rsEvent.Fields.Item("startYear").Value))) Then If ("2008" = CStr((rsEvent.Fields.Item("startYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2008</option>
            <option value="2009" <%If (Not isNull((rsEvent.Fields.Item("startYear").Value))) Then If ("2009" = CStr((rsEvent.Fields.Item("startYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2009</option>
            <option value="2010" <%If (Not isNull((rsEvent.Fields.Item("startYear").Value))) Then If ("2010" = CStr((rsEvent.Fields.Item("startYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2010</option>
            <option value="2011" <%If (Not isNull((rsEvent.Fields.Item("startYear").Value))) Then If ("2011" = CStr((rsEvent.Fields.Item("startYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2011</option>
            <option value="2012" <%If (Not isNull((rsEvent.Fields.Item("startYear").Value))) Then If ("2012" = CStr((rsEvent.Fields.Item("startYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2012</option>
            <option value="2013" <%If (Not isNull((rsEvent.Fields.Item("startYear").Value))) Then If ("2013" = CStr((rsEvent.Fields.Item("startYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2013</option>
            <option value="2014" <%If (Not isNull((rsEvent.Fields.Item("startYear").Value))) Then If ("2014" = CStr((rsEvent.Fields.Item("startYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2014</option>
            <option value="2015" <%If (Not isNull((rsEvent.Fields.Item("startYear").Value))) Then If ("2015" = CStr((rsEvent.Fields.Item("startYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2015</option>
          </select>
          <label for="endMonth"> End:<span class="smallRed">*</span></label>
          <select name="endMonth" id="endMonth" size="1" tabindex="6">
            <option selected="selected" value="" <%If (Not isNull((rsEvent.Fields.Item("endMonth").Value))) Then If ("" = CStr((rsEvent.Fields.Item("endMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Month</option>
            <option value="01" <%If (Not isNull((rsEvent.Fields.Item("endMonth").Value))) Then If ("01" = CStr((rsEvent.Fields.Item("endMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>January</option>
            <option value="02" <%If (Not isNull((rsEvent.Fields.Item("endMonth").Value))) Then If ("02" = CStr((rsEvent.Fields.Item("endMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>February</option>
            <option value="03" <%If (Not isNull((rsEvent.Fields.Item("endMonth").Value))) Then If ("03" = CStr((rsEvent.Fields.Item("endMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>March</option>
            <option value="04" <%If (Not isNull((rsEvent.Fields.Item("endMonth").Value))) Then If ("04" = CStr((rsEvent.Fields.Item("endMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>April</option>
            <option value="05" <%If (Not isNull((rsEvent.Fields.Item("endMonth").Value))) Then If ("05" = CStr((rsEvent.Fields.Item("endMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>May</option>
            <option value="06" <%If (Not isNull((rsEvent.Fields.Item("endMonth").Value))) Then If ("06" = CStr((rsEvent.Fields.Item("endMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>June</option>
            <option value="07" <%If (Not isNull((rsEvent.Fields.Item("endMonth").Value))) Then If ("07" = CStr((rsEvent.Fields.Item("endMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>July</option>
            <option value="08" <%If (Not isNull((rsEvent.Fields.Item("endMonth").Value))) Then If ("08" = CStr((rsEvent.Fields.Item("endMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>August</option>
            <option value="09" <%If (Not isNull((rsEvent.Fields.Item("endMonth").Value))) Then If ("09" = CStr((rsEvent.Fields.Item("endMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>September</option>
            <option value="10" <%If (Not isNull((rsEvent.Fields.Item("endMonth").Value))) Then If ("10" = CStr((rsEvent.Fields.Item("endMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>October</option>
            <option value="11" <%If (Not isNull((rsEvent.Fields.Item("endMonth").Value))) Then If ("11" = CStr((rsEvent.Fields.Item("endMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>November</option>
            <option value="12" <%If (Not isNull((rsEvent.Fields.Item("endMonth").Value))) Then If ("12" = CStr((rsEvent.Fields.Item("endMonth").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>December</option>
          </select>
          <select name="endDay" id="endDay" size="1" tabindex="7">
            <option value="0" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("0" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Day</option>
            <option value="1" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("1" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>1</option>
            <option value="2" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("2" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2</option>
            <option value="3" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("3" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>3</option>
            <option value="4" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("4" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>4</option>
            <option value="5" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("5" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>5</option>
            <option value="6" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("6" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>6</option>
            <option value="7" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("7" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>7</option>
            <option value="8" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("8" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>8</option>
            <option value="9" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("9" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>9</option>
            <option value="10" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("10" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>10</option>
            <option value="11" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("11" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>11</option>
            <option value="12" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("12" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>12</option>
            <option value="13" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("13" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>13</option>
            <option value="14" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("14" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>14</option>
            <option value="15" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("15" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>15</option>
            <option value="16" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("16" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>16</option>
            <option value="17" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("17" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>17</option>
            <option value="18" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("18" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>18</option>
            <option value="19" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("19" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>19</option>
            <option value="20" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("20" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>20</option>
            <option value="21" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("21" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>21</option>
            <option value="22" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("22" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>22</option>
            <option value="23" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("23" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>23</option>
            <option value="24" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("24" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>24</option>
            <option value="25" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("25" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>25</option>
            <option value="26" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("26" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>26</option>
            <option value="27" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("27" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>27</option>
            <option value="28" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("28" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>28</option>
            <option value="29" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("29" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>29</option>
            <option value="30" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("30" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>30</option>
            <option value="31" <%If (Not isNull((rsEvent.Fields.Item("endDay").Value))) Then If ("31" = CStr((rsEvent.Fields.Item("endDay").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>31</option>
          </select>
          <select name="endYear" id="endYear" size="1" tabindex="8">
            <option value="" <%If (Not isNull((rsEvent.Fields.Item("endYear").Value))) Then If ("" = CStr((rsEvent.Fields.Item("endYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Year</option>
            <option value="2008" <%If (Not isNull((rsEvent.Fields.Item("endYear").Value))) Then If ("2008" = CStr((rsEvent.Fields.Item("endYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2008</option>
            <option value="2009" <%If (Not isNull((rsEvent.Fields.Item("endYear").Value))) Then If ("2009" = CStr((rsEvent.Fields.Item("endYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2009</option>
            <option value="2010" <%If (Not isNull((rsEvent.Fields.Item("endYear").Value))) Then If ("2010" = CStr((rsEvent.Fields.Item("endYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2010</option>
            <option value="2011" <%If (Not isNull((rsEvent.Fields.Item("endYear").Value))) Then If ("2011" = CStr((rsEvent.Fields.Item("endYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2011</option>
            <option value="2012" <%If (Not isNull((rsEvent.Fields.Item("endYear").Value))) Then If ("2012" = CStr((rsEvent.Fields.Item("endYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2012</option>
            <option value="2013" <%If (Not isNull((rsEvent.Fields.Item("endYear").Value))) Then If ("2013" = CStr((rsEvent.Fields.Item("endYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2013</option>
            <option value="2014" <%If (Not isNull((rsEvent.Fields.Item("endYear").Value))) Then If ("2014" = CStr((rsEvent.Fields.Item("endYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2014</option>
            <option value="2015" <%If (Not isNull((rsEvent.Fields.Item("endYear").Value))) Then If ("2015" = CStr((rsEvent.Fields.Item("endYear").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2015</option>
          </select>
          <br />
          <label for="host">Host:</label>
          <input name="host" type="text" id="host" tabindex="9" value="<%=(rsEvent.Fields.Item("host").Value)%>" size="72" maxlength="72" />
          <br />
          <label for="district">District:</label>
          <select name="district" id="district" size="1" tabindex="10">
            <%
While (NOT rsDistricts.EOF)
%>
            <%
  rsDistricts.MoveNext()
Wend
If (rsDistricts.CursorType > 0) Then
  rsDistricts.MoveFirst
Else
  rsDistricts.Requery
End If
%>
            <%
While (NOT rsDistricts.EOF)
%>
            <option value="<%=(rsDistricts.Fields.Item("districtName").Value)%>" <%If (Not isNull((rsEvent.Fields.Item("district").Value))) Then If (CStr(rsDistricts.Fields.Item("districtName").Value) = CStr((rsEvent.Fields.Item("district").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsDistricts.Fields.Item("districtName").Value)%></option>
            <%
  rsDistricts.MoveNext()
Wend
If (rsDistricts.CursorType > 0) Then
  rsDistricts.MoveFirst
Else
  rsDistricts.Requery
End If
%>
            <%
While (NOT rsDistricts.EOF)
%>
            <option value="<%=(rsDistricts.Fields.Item("districtName").Value)%>" <%If (Not isNull((rsEvent.Fields.Item("district").Value))) Then If (CStr(rsDistricts.Fields.Item("districtName").Value) = CStr((rsEvent.Fields.Item("district").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsDistricts.Fields.Item("districtName").Value)%></option>
            <%
  rsDistricts.MoveNext()
Wend
If (rsDistricts.CursorType > 0) Then
  rsDistricts.MoveFirst
Else
  rsDistricts.Requery
End If
%>
          </select>
          <label for="fleet"></label>
          <label for="fleet">Fleet:</label>
          <select name="fleet" id="fleet" size="1" tabindex="11">
            <%
While (NOT rsFleet.EOF)
%>
            <option value="<%=(rsFleet.Fields.Item("fleet").Value)%>" <%If (Not isNull((rsEvent.Fields.Item("fleet").Value))) Then If (CStr(rsFleet.Fields.Item("fleet").Value) = CStr((rsEvent.Fields.Item("fleet").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsFleet.Fields.Item("fleet").Value)%></option>
            <%
  rsFleet.MoveNext()
Wend
If (rsFleet.CursorType > 0) Then
  rsFleet.MoveFirst
Else
  rsFleet.Requery
End If
%>
            <%
While (NOT rsFleet.EOF)
%>
            <option value="<%=(rsFleet.Fields.Item("fleet").Value)%>" <%If (Not isNull((rsEvent.Fields.Item("fleet").Value))) Then If (CStr(rsFleet.Fields.Item("fleet").Value) = CStr((rsEvent.Fields.Item("fleet").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsFleet.Fields.Item("fleet").Value)%></option>
            <%
  rsFleet.MoveNext()
Wend
If (rsFleet.CursorType > 0) Then
  rsFleet.MoveFirst
Else
  rsFleet.Requery
End If
%>
          </select>
          <label for="stateProvince"></label>
          <label for="city">City:</label>
          <input name="city" type="text" id="city" tabindex="12" value="<%=(rsEvent.Fields.Item("city").Value)%>" size="24" maxlength="24" />
          <br />
          <label for="stateProvince"></label>
          <label for="stateProvince">State/Prov:</label>
          <select name="stateProvince" id="stateProvince" size="1" tabindex="13">
            <%
While (NOT rsStates.EOF)
%>
            <option value="<%=(rsStates.Fields.Item("stateName").Value)%>" <%If (Not isNull((rsEvent.Fields.Item("stateProvince").Value))) Then If (CStr(rsStates.Fields.Item("stateName").Value) = CStr((rsEvent.Fields.Item("stateProvince").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsStates.Fields.Item("stateName").Value)%></option>
            <%
  rsStates.MoveNext()
Wend
If (rsStates.CursorType > 0) Then
  rsStates.MoveFirst
Else
  rsStates.Requery
End If
%>
          </select>
          <label for="country"><span class="smallRed">*</span>Country:</label>
          <label for="contact2">
          <select name="country" id="country" size="1" tabindex="14">
            <%
While (NOT rsCountry.EOF)
%>
            <%
  rsCountry.MoveNext()
Wend
If (rsCountry.CursorType > 0) Then
  rsCountry.MoveFirst
Else
  rsCountry.Requery
End If
%>
            <%
While (NOT rsCountry.EOF)
%>
            <option value="<%=(rsCountry.Fields.Item("countryName").Value)%>" <%If (Not isNull((rsEvent.Fields.Item("country").Value))) Then If (CStr(rsCountry.Fields.Item("countryName").Value) = CStr((rsEvent.Fields.Item("country").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsCountry.Fields.Item("countryName").Value)%></option>
            <%
  rsCountry.MoveNext()
Wend
If (rsCountry.CursorType > 0) Then
  rsCountry.MoveFirst
Else
  rsCountry.Requery
End If
%>
          </select>
          <br />
          Contact:</label>
          <input name="contact" type="text" id="contact" tabindex="15" value="<%=(rsEvent.Fields.Item("contact").Value)%>" size="20" maxlength="20" />
          <label for="eddress">Email:</label>
          <input name="eddress" type="text" id="eddress" tabindex="16" value="<%=(rsEvent.Fields.Item("eddress").Value)%>" size="40" maxlength="82" />
          <label for="phone"> <br />
          Phone:</label>
          <input name="phone" type="text" id="phone" tabindex="17" value="<%=(rsEvent.Fields.Item("phone").Value)%>" size="18" maxlength="28" />
          <label for="eddress2">Other Email:</label>
          <input name="eddress2" type="text" id="eddress2" tabindex="18" value="<%=(rsEvent.Fields.Item("eddress2").Value)%>" size="36"  maxlength="82" />
          <br />
          <div id="webComment"> <span class="smallRed">US/Canadian Format: 999-999-9999</span> </div>
          <label for="website"> Website:</label>
          <input name="website" type="text" id="website" tabindex="19" value="<%=(rsEvent.Fields.Item("website").Value)%>" size="70" maxlength="70" />
          <div id="webComment"> <span class="smallRed">Must be a complete URL: http://www.domain.com/folder/filename.htm</span> </div>
          <label for="comments"><strong><br />
          </strong><span class="hpnewsHlt"><strong>Event Details:</strong></span></label>
          <p class="smallRed"> Use this field for additional details about the event or for special instructions. You may enter data directly into the text box or copy and paste from your Word document. Do not paste text that includes HTML tags. Please include the <strong>address of the club or venue</strong>, <strong>social events planned</strong>. <strong>club burgee or photo.</strong> <br />
            <br />
            <textarea name="comments" id="comments" cols="75" tabindex="20"><%=(rsEvent.Fields.Item("comments").Value)%></textarea>
            <br />
          <div id="recaptcha"> Validate: <%=recaptcha_challenge_writer(recaptcha_public_key)%> </div>
        </div>
          </p>
        </fieldset>
        <div id="submitForm">
          <input name="submit" type="submit" id="submit" value="Submit" />
        </div>
        <input type="text" name="MM_recordId" value="<%= rsEvent.Fields.Item("ID").Value %>" />
      </form>
<%
' The code below supplied by Mark Short 
 
' returns string the can be written where you would like the reCAPTCHA challenged placed on your page 
function recaptcha_challenge_writer(publickey) 
  recaptcha_challenge_writer = "<script type=""text/javascript"">" & _ 
  "var RecaptchaOptions = {" & _ 
  " theme : 'white'," & _ 
  " tabindex : 0" & _ 
  "};" & _ 
  "</script>" & _ 
  "<script type=""text/javascript"" src=""http://api.recaptcha.net/challenge?k=" & publickey & """></script>" & _ 
  "<noscript>" & _ 
  "<iframe src=""http://api.recaptcha.net/noscript?k=" & publickey & """ frameborder=""1""></iframe><br>" & _ 
  "<textarea name=""recaptcha_challenge_field"" rows=""3"" cols=""40""></textarea>" & _ 
  "<input type=""hidden"" name=""recaptcha_response_field"" value=""manual_challenge"">" & _ 
  "</noscript>" 
end function 
%>
      <!-- InstanceEndEditable --> </div>
  </div>
  <div id="clear"></div>
  <div id="footer">
    <p><u><a href="../../membership/joinRenew/membershipOptions.asp" class="ftrLinks">Membership</a></u> | <u><a href="eventSelect.asp" class="ftrLinks">Racing</a></u> | <u><a href="../../classRules/documents/ilcaBylaws.asp" class="ftrLinks">Class Rules</a></u> | <u><a href="../../photoGallery/photos2008/index.asp" class="ftrLinks">Photo Gallery</a></u> | <u class="ftrLinks"><a href="../../marketplace/store/index.asp">Marketplace</a></u> | <u><a href="../../contacts/index.asp" class="ftrLinks">Contacts</a></u> | <u class="ftrLinks"><a href="../../siteMap.asp">Site Map</a></u><br />
      All Rights ReservedInternational Lightning Class Association<br />
      <u><a href="mailto:office@lightningclass.org" class="ftrLinks">office@lightningclass.org</a></u><br />
      7625 South Yampa Street, Centennial, Colorado 80016  Phone: 303-325-5886  Fax: 303-699-2178  Skype: ilcaoffice</p>
  </div>
</div>
</body>
<!-- InstanceEnd -->
</html>
<%
rsStates.Close()
Set rsStates = Nothing
%>
<%
rsCountry.Close()
Set rsCountry = Nothing
%>
<%
rsDistricts.Close()
Set rsDistricts = Nothing
%>
<%
rsFleet.Close()
Set rsFleet = Nothing
%>
<%
rseventClass.Close()
Set rseventClass = Nothing
%>
<%
rsEvent.Close()
Set rsEvent = Nothing
%>

Open in new window

Avatar of slegy

ASKER

There is an error in the first ID check. I tried a variety of combinations. None work. Now reads: If Request.Form("ID") <> 192 Then
Avatar of slegy

ASKER

You are finally liberated - I think I've got it!!
eventUpdate.asp:
<form action="eventupdateValidate.asp?ID=<%=rsEvent.Fields.Item("ID").Value %>" method="post" name="eventUpdate" id="eventUpdate">
I have a little more testing to do, but please don't spent any more of your valuable time. You've saved my sanity.
Be careful with this, it is less secure than passing the ID within a hidden form field.  Your original way is better using a hidden form field to store the ID.  Post the code for the two pages and I will see why it wasn't working
Avatar of slegy

ASKER

The code that wasn't working is listed above (03.16.2009 at 11:23AM MST). There was an error in checking the contents of the ID field (I tried several combinations to make sure it was empty). I'm sure there was nothing in it. Other than the fact that it was a hidden form field, I couldn't figure out why it wasn't handled like the rest of the fields (even when I made it displayable it didn't pass).
Change this:

ID                         = SQLEncode(Request("ID"))

to this:

ID                         = SQLEncode(Request.Form("MM_recordId"))

Avatar of slegy

ASKER

Yes, it works! I hate it when the answer is so obvious.
If I can, just one last thing. I have a third form - just like eventUpdate.asp but with some additional fields used by the individual who largely maintains the site. There is a checkbox to specify whether or not another page should be displayed. The original Dreamweaver code didn't work after all the changes you suggested were made, so I thought I could recode for it, but it doesn't work.
Original Dreamweaver code:
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param25", 5, 1, -1, MM_IIF(Request.Form("whosComing"), 1, 0)) ' adDouble
The MM_IIF command errored out. I tried IIF and IF but it doesn't like that either. So in the validation section I added:

 If Request.Form("whosComing") <> "" Then
  whosComing = True
  else
   whosComing = False
 End If
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param25", 5, 1, -1, whosComing) ' adDouble
The values get set, but the update proccess errors out with:

Microsoft OLE DB Provider for ODBC Drivers error '80040e57'
[Microsoft][ODBC Microsoft Access Driver]Invalid string or buffer length
/racing/calendar/eventdocsupdateValidate.asp, line 241: MM_editCmd.Execute
whosComing is being set in ASP as a BOOLEAN data type.  These can hold the following values only:

   > TRUE or FALSE
   > 1 or 0

However, it appears that the SQL command is trying to save it as a DOUBLE data type (for large numbers only).

So the error comes when that value attempts to be converted from one type to another (like converting a computer to an ice cream!)

Please check which data type the database is storing these values as.  The following revision presumes you are using an Access "YES/NO" data type (called Boolean in other languages) to store this data:


MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param25", 11, 1, -1, whosComing)
Avatar of slegy

ASKER

Where did you find value "11"? Here's what I've been working with. This worked when everything was in one form.

Commands (Insert, Update, Delete)

Value  Constant               Value in          Size            Database data type
                                         Dreamweaver  
   5       adDouble              Double              -1      Numeric (Access, MS SQL, MySQL
   5       adBoolean             Double             -1      Boolean, Yes/No (Access, MS SQL, MySQL
135   adDBTimeStamp  DBTimeStamp -1      Date/Time (Access, SQL Server, MySQL
201  adLongVarChar  LongVarChar    check
                                                               Databases
                                                                    panel   all other types of text fields, including
                                                                                 the MySQL text data types char, varchar and
                                                                                 longtext
202  adVarWChar          VarWChar        check
                                                                Databases
                                                                      panel Text (Access) or nvarchar, nchar (MS SQL) 203  adLongVarWChar LongVarWChar 1073741823 Memo (Access) or ntext (MS SQL)
                                                                        or: these fields supports large amounts of text.
http://kb.adobe.com/selfservice/viewContent.do?externalId=4e6b330a&sliceId=1
Still received the same error.
The value 11 comes from this resource:
http://www.w3schools.com/ado/met_comm_createparameter.asp

11 corresponds to adBoolean which is a true or false data type.   I really don't understand why Adobe says that you use Double data type for Boolean inserts.  They are not the same data type and you are getting an error.

Are you using Microsoft Access, MySQL or SQL Server?
And also what is the data type of the database column?
Avatar of slegy

ASKER

Microsoft Access. The column is Yes/No. I understand completely what you are saying, but when I initially added the Who's Coming checkbox to the form and allowed Dreamweaver to create the insert code, the database update worked perfectly - there were checkmarks in the database field for those events where the Who's Coming box had been checked.
Previous Code:

    ' execute the update
    Dim MM_editCmd
    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_eventCalendar_STRING
    MM_editCmd.CommandText = "UPDATE eventCalendar SET classification = ?, eventTitle = ?, [eventTitle-long] = ?, startMonth = ?, startDay = ?, startYear = ?, endMonth = ?, endDay = ?, endYear = ?, [host] = ?, district = ?, fleet = ?, city = ?, stateProvince = ?, country = ?, contact = ?, eddress = ?, phone = ?, eddress2 = ?, website = ?, nor = ?, sailingInstructions = ?, entryForm = ?, [map] = ?, whosComing = ?, comments = ? WHERE ID = ?"    
. . . . . . . . . . .
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param25", 5, 1, -1, MM_IIF(Request.Form("whosComing"), 1, 0)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param26", 203, 1, 1073741823, Request.Form("comments")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param27", 5, 1, -1, MM_IIF(Request.Form("MM_recordId"), Request.Form("MM_recordId"), null)) ' adDouble
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
It is obvius what the MM_IIF is doing, but it errors out when the Request.Form is removed. Will continue testing.
Okay post your full page code again which includes the whosComing variable and I'll have a look at where the problem is.
Avatar of slegy

ASKER

I couldn't live with the idea of your spending any more time on this, so I went back through, starting with what worked and then adding each additional field one at a time. It is now working. I'm not absolutely sure what got corrected - it may have been a misspelling of one of the link fields - not the Who's Coming.
In summary, this code was added to the validation:

 If Request.Form("whosComing") <> "" Then
  whosComing = 1
  else
   whosComing = 0
 End If
Update entry:
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param25", 5, 1, -1, whosComing) ' adDouble
I can't thank you enough for all of your expertise, time and patience - and for everything I learned from this experience. I hope many others will benefit as well.
You're welcome Slegy.

And don't worry about the time involved here.  I get my satisfaction by knowing that I've helped you out, and if you've also learned something in the process then that's even better.