Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I going back?
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00821939
Message ID:
00824295
Views:
24
>I would post so more eyes can see.
>Be sure to post the code between < pre> and < /pre> tags so it formats correctly.
------------------
Ok, here it is
What I'd like to see happen is when the submit button is clicked,
that evidence would present itself that I was in the onsubmit code.
(I have a javascript alert("Inside frmRDCST3_onsubmit!") I think should pop-up)

Once we get to there I'll add back in the remainder of my validation code and my save code.
Part of what my validation code hopes to do is to display the labels in red for the fields that fail the validation.
The save code already works when I call it in another ASP file, so it should work here...if I can get the call to the ONSUBMIT (aka - validation code) to work.

TIA,
Rick
<%@ Language=VBScript %>
<% Response.Buffer=True %>
<HTML>
<HEAD>
	<TITLE>Rick's Data Collection Session Table Access Page</TITLE>
	
	<script LANGUAGE="javascript">
		Function frmRDCST3_onsubmit()
		{
			alert("Inside frmRDCST3_onsubmit!")
			
			//form validation routines
			//================================
			var MustHaves
			var Wants
			var ZipFormat
			
			MustHaves = true;
			Wants     = true;
			ZipFormat = true;
			
			// non-relevant code removed to save space
			
			if MustHaves=false || Wants=false || ZipFormat=false
			{
				window scroll(0,0);
				return false;
			}
			else
			{
				save();
				return true;
			}
		}
	</script>
	
	<SCRIPT LANGUAGE="VBScript" >
		Function save()
			msgbox("Inside Save!")
			
			'Rick's Data Collection Session Table record creation Page
			'non-relevant code removed to save space
		END Function
	</script>
</HEAD>
<BODY>
	<H1 ALIGN="Center">Rick's Data Collection Response Page - Table Content</H1>
	<%
	Dim myString, mySQLstring
	Dim objRecordSet, objConnection, strConnection 
	
	SET objRecordSet = Server.CreateObject("ADODB.RecordSet")
	SET objConnection = Server.CreateObject("ADODB.Connection")
	
	strConnection = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:\inetpub\wwwroot\rick\nwind.mdb"
	objConnection.Open strConnection

	mySQLstring = "SELECT * FROM Customers ORDER BY CustomerID"
	SET objRecordSet = objConnection.Execute(mySQLstring, intRecordsAffected)
	
	IF intRecordsAffected < 0 THEN 
		objRecordSet.MoveFirst
	%>
		<CENTER>
		Display upto the first 5 records matching the following SQL Statement<BR>
		<! SQL Statement: SELECT * FROM Customers ORDER BY CustomerID>
		SQL Statement: <%= mySQLstring %>
		<TABLE BORDER=1 COLS=<%=objRecordSet.Fields.Count %> >
			<TR>
				<% FOR EACH objField in objRecordSet.Fields %>
					<TH><%= objField.Name %></TH>
				<% NEXT %>
			</TR>
			<% 
				intRecordsAffected = 0
				DO WHILE NOT objRecordSet.EOF AND intRecordsAffected < 5 %>
				<TR>
					<% FOR EACH objField in objRecordSet.Fields
					%>
						<TD ALIGN=Right >
							<%
							IF ISNULL(objField) THEN
								Response.Write(" ")
							ELSE
								myString = objField.Value
								IF VARTYPE(mystring)=8 Then
									'do nothing
								ELSE
									IF VARTYPE(mystring)=1 THEN
										myString = ".NULL."
									ELSE
										'do nothing
									END IF
								END IF
								Response.Write(myString)
								'Response.Write(objField.Value)
							END IF
							%>
						</TD>
					<% NEXT 
					   intRecordsAffected = intRecordsAffected + 1
					   objRecordSet.MoveNext 
					%>
				</TR>
			<% LOOP %>
		</TABLE>
		<%
		Response.Write(intRecordsAffected & " records displayed!" )
		%>
		</CENTER>
		<! Add new record>
		<! CustomerID - C(5) - Unique five-character code based on customer name.>
		<! CompanyName - C(40) >
		<! ContactName - C(30) >
		<! ContactTitle - C(30) >
		<! Address - C(60) - Street or post-office box. >
		<! City - C(15) >
		<! Region - C(15) - State or province. >
		<! PostalCode - C(10) >
		<! Country - C(15) >
		<! Phone - C(24) - Phone number includes country code or area code. >
		<! Fax - C(24) - Phone number includes country code or area code. >
		<%
		Dim txtCustomerID, txtCompanyName, txtContactName, txtContactTitle, txtAddress, txtCity, txtRegion, txtPostalCode, txtCountry, txtPhone, txtFax
		txtCustomerID = "AAAAA"
		txtCompanyName = "CompanyName"
		txtContactName = "ContactName"
		txtContactTitle = "ContactTitle"
		txtAddress = "Address"
		txtCity = "City"
		txtRegion = "Region/State"
		txtPostalCode = "PostalCode"
		txtCountry = "Country"
		txtPhone = "Phone"
		txtFax = "Fax"
		%>
		<HR>
		<FORM ACTION="rdc_f_cookie_session_table3.asp" NAME="frmRDCST3" METHOD="post" LANGUAGE="javascript" onsubmit="return frmRDCST3_onsubmit()">
			<TABLE>
				<TH COLSPAN=3>Create New Customer record - all fields required!</TH>
				<TR>
					<TD><LABEL CLASS="InputLbl" ID="lblCustomerID">Customer ID:</LABEL></TD>
					<TD><INPUT ID="txtCustomerID" NAME="txtCustomerID" SIZE="6" MAXLENGTH="5" VALUE= <%=Request.Form("txtCustomerID") %>></TD>
					<TD>Unique five-character code based on customer name</TD>
				</TR>
				<! non-relevant code removed to save space >
				<TR>
					<TD></TD>
					<TD><INPUT ID="cmdSubmit" NAME="cmdSubmit" TYPE="SUBMIT" VALUE="Create New Customer Record"></TD>
					<TD></TD>
				</TR>
			</TABLE>
		</FORM>
		<%
		objRecordSet.Close
		SET objRecordSet = Nothing
	END IF
		%>
	
</BODY>
</HTML>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform